Developer

OpenUI Overview for iOS

OpenUI enables application designers to programmatically customize applications, using the platform's natural language, by defining the views for each field in an Agentry screen. Objective-C is the natural language for iOS.

The OpenUI framework in iOS allows an arbitrary Objective-C class to become an extension to an Agentry screen field. The class must implement the proper SMPOpenUIFieldAdapter protocol, which enables Agentry to:
  • Notify the class when the data it is showing has been modified, or when some of its display attributes have changed.

  • Request desired behavior from the class, such as whether Agentry should show a field label.

  • Request from the class the view to show in the Agentry screen.

To enable this behavior, the application designer must provide the name of the adapter class for the field in Agentry Editor. This is done via the Field Extension tab in the editor for each field type that supports OpenUI extensions. For more details, see Developer > Agentry App Development > Agentry OpenUI API > Agentry OpenUI API for iOS > OpenUI Installation Instructions (iOS) > OpenUI Getting Started (iOS).

All field extension adapters are provided at initialization for an object that implements the proper SMPOpenUIFieldModel protocol. By using this object, the adapter object can query Agentry for the data the adapter is required to represent, and other attributes.

For each specific field type that supports OpenUI, the user can enter the adapter extension class name in the Agentry Editor in the Extension tab of the field definition. This causes the framework to try to instantiate an adapter with that class name at runtime, and show its view in the corresponding screen where the field was defined.

Adapter Protocols

All adapter protocols are listed in Agentry OpenUI API for iOS. When a screen is constructed by the Agentry Client, the client checks to see if a field has been extended. If so, it then checks to see if the provided extension class implements the correct adapter protocol for the field type. If so, it instantiates the adapter class, and provides it with a model. After this, a UIView is requested from the adapter to be shown by Agentry in the detail screen.

Model Protocols

Objects that implement the correct model protocol are provided to adapters at construction, to serve as access to the data in Agentry, as well as provide methods to modify any data the user enters.

The following class diagram shows how models and adapters work together with Agentry:

For the interface documentation of all the available OpenUI Objective-C protocols, see the iOSOpenUIExternal module in source code.