Customize View using ViewFactory
In the following sections, we will discuss the UIKit ViewFactory and how to use it to customize various IQL flows:
How ViewFactory Customizations Work
How ViewFactory
Customizations Work
ViewFactory
Customizations WorkThe ZendriveIQLUIKitViewFactory
is a class that allows users to customize the appearance and behavior of various views of the IQL flow. ZendriveUIKit will ask the View Factory to create customized views and will share the data with the View object to be used in UI creation/updation.
Key Components
Default Implementations: The
ZendriveIQLUIKitViewFactory
includes default implementations for creating views, such asCombinedProgramSummaryWidget
andDashboardScreen
. These default implementations serve as templates that users can customize to meet their needs.Customization: Users can extend the
ZendriveIQLUIKitViewFactory
class and override specific methods to provide their own implementations of views. This customization enables developers to modify the appearance, behavior, and functionality of views according to their application's requirements.
Customize Views
Extend ZendriveIQLUIKitViewFactory
ZendriveIQLUIKitViewFactory
To begin customizing views, developers should create their own class that extends the ZendriveIQLUIKitViewFactory
:
class CustomViewFactory : ZendriveIQLUIKitViewFactory() {
// Override methods to customize views
}
Override Methods
Within the custom ZendriveIQLUIKitViewFactory
, users can override methods corresponding to the views they want to customize. For example, to customize the CombinedProgramSummaryWidget, users need to override the createCombinedProgramSummaryWidget
method:
Provide Custom Implementations
Developers should provide their own implementations of views that adhere to the base classes defined in ZendriveIQLUIKit.
For instance, in iOS if an app requires a distinct appearance or added functionality for the CombinedProgramSummaryWidget
, developers can create a custom view that implements the BaseCombinedProgramSummaryWidget
base class and for Android they can extend CombinedProgramSummaryWidgetView
Below is an example of how developers can customize the CombinedProgramSummaryWidget
Set View Factory in ZendriveIQLUIKit
ZendriveIQLUIKit
To use the custom ZendriveIQLUIKitViewFactory
, developers must instantiate it and pass it to ZendriveIQLUIKit.
Here is how to set it to UIKit:
ZendriveIQLUIKit.setViewFactory(viewFactory: CustomViewFactory())