Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Custom Pega Mobile Client modules for the iOS platform

Updated on September 3, 2019

You can write custom Pega® Mobile Client modules for the iOS platform in Objective-C or Swift and expose their functionality through the JavaScript API. Custom modules enable features and functions that are normally available in native applications. For example, a custom module can allow a Pega Platform mobile app to use a tablet's projector module to display the wiring layout of equipment that needs to be serviced. As an iOS developer you can develop, compile, debug, and test custom modules before building the final application custom modules by using the Xcode development environment.

Custom modules can contain plug-in classes (the JavaScript code and the native implementation), extension classes, and other assets that are required to provide the functionality. You can integrate custom modules with the Pega Mobile Client by creating dependencies on existing modules from Pega, as well as increase their versatility by integrating third-party libraries that are written in Objective-C or Swift, for example to enable image editing.

Custom modules and extension classes do not apply to Apple App Extensions. Pega Mobile Client does not support App Extensions.

Distribution package

The distribution package is available from your Pegasystems Global Customer Support representative. The distribution package file contains all the resources that you need to build a Pega Mobile Client-based custom mobile app, such as libraries, product modules, documentation, scripts, styles, and graphic files.

Dependencies on Pega Mobile Client modules

Pega Mobile Client consists of several modules. For example, the Base module contains the basic functionality of the Pega Mobile Client and is required for creating custom modules. A custom module can have dependencies on product modules other than Base. All Pega Mobile Client modules are available in the Frameworks directory of the distribution package.

For more information, see Adding third-party dependencies.

Plug-in classes

Custom modules contain one or more plug-in classes. You use these classes to obtain access to native functionalities or to native APIs of the device. Plug-in classes use a bridge between JavaScript and the native side to respond to JavaScript requests and initiate JavaScript events. All plug-in classes on the iOS platform must inherit from the PMJavaScriptPlugin class. Classes that inherit from this class are instantiated for each WKWebView instance when this instance is created, and they remain valid within this instance for the instance lifetime.

You use a plug-in class to return a JavaScript code as an NSString class. The plug-in class is injected into the WKWebView JavaScript code that can be hardcoded, generated, or read from the resource bundle. Pega Mobile Client asks for the JavaScript code by calling the provideJavaScriptWithCompletionHandler: method on the PMJavaScriptPlugin instance. JavaScript code that is returned by the plug-in class is injected into the WKWebView instance during the web application startup before the onLaunchboxLoaded method is called. An instance of the bridge object is available during the injection phase. JavaScript code must use this instance to communicate with the native code.

All JavaScript communication must pass through the main Grand Central Dispatch queue (UI classes can be called only on the main thread). To conserve performance of the UI and JavaScript bridge, all JavaScript code that does not have to run on the main queue must run on private Grand Central Dispatch queues. This is why the dispatchQueue method has been implemented in the PMJavaScriptPlugin class. The PMJavaScriptPlugin class is used by the JavaScript bridge to ask plug-in class instances for their queue when passing JavaScript calls.

For information about creating plug-in classes, see Extending Pega Mobile Client with plug-in classes.

Extension classes

To further extend the Pega Mobile Client, for example, to grant the custom mobile app access to native events or to respond to system events, you can use extension classes. Custom modules contain one or more extension classes. An extension class enables simple initialization, such as creating single instances or registering for UIApplication notifications. Its instance is created once, at client startup, and remains valid within the client for its lifetime. If the custom module library contains more than one extension class, Pega Mobile Client creates an instance for each of them.

All extension classes must inherit from the PMApplicationPlugin class. Such classes are instantiated when the application is initiated, and remain valid for its lifetime.

To create the main extension class, you must create a subclass of the PMApplicationPlugin class. Pega Mobile Client instantiates all subclasses of the PMApplicationPlugin class by calling the init selector in the Pega Mobile Client's UIApplicationDelegate init file. The extension class can react to the events from the UIApplicationDelegate protocol that are defined in the PMUIApplicationDelegate protocol.

For infomation about creating extension classes, see Extending Pega Mobile Client with extension classes.

Sample custom module

This article includes a working example of a custom module. Before you create your own module, you can analyze the contents and structure of a sample custom module that was created in Xcode by downloading the following file and following the instructions in Developing custom Pega Mobile Client modules for the iOS platform. (6 MB)

Related articles

Pega Mobile ClientPega Mobile Client modules and custom modulesDeveloping custom Pega Mobile Client modules for the iOS platform


Mobile Communications and Media Consumer Services Financial Services Government Healthcare and Life Sciences Insurance Healthcare and Life Sciences

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us