File
→ Add Packages...
, enter FlowX repo’s URL https://github.com/flowx-ai/flowx-ios-sdk
.
Set the dependency rule to Up To Next Major
and add package.
If you are developing a framework and use FlowX as a dependency, add to your Package.swift
file:
pod install
Name | Description | Type | Requirement |
---|---|---|---|
baseURL | The base URL used for REST networking | String | Mandatory |
imageBaseURL | The base URL used for media library images | String | Mandatory |
language | The language used for retrieving enumerations and substitution tags | String | Mandatory. Defaults to “en” |
stepViewType | The type of the custom step view class | FXStepViewProtocol.Type | Optional |
logEnabled | Value indicating whether console logging is enabled. Default is false | Bool | Optional |
Name | Description | Type |
---|---|---|
sessionManager | Alamofire session instance used for REST networking | Session |
token | JWT authentication access token | String |
FlowX.sharedInstance
.
startSession()
method.
This is optional, as the session starts lazily when the first process is started.
FlowX.sharedInstance.startSession()
When you want to end a FlowX session, you can call the endSession()
method. This also does a complete clean-up of the started processes.
You might want to use this method in a variety of scenarios, for instance when the user logs out.
FlowX.sharedInstance.endSession()
navigationController
- the instance of UINavigationController which will hold the process navigation stack
name
- the name of the process
params
- the start parameters, if any
isModal
- a boolean indicating whether the process navigation is modally displayed. When the process navigation is displayed modally, a close bar button item is displayed on each screen displayed throughout the process navigation.
showLoader
- a boolean indicating whether the loader should be displayed when starting the process.
uuid
- the UUID string of the process
name
- the name of the process
navigationController
- the instance of UINavigationController which will hold the process navigation stack
isModal
- a boolean indicating whether the process navigation is modally displayed. When the process navigation is displayed modally, a close bar button item is displayed on each screen displayed throughout the process navigation.
stopProcess(name: String)
method.
This is useful when you want to explicitly ask the FlowX shared instance to clean up the instance of the process sent as parameter.
For example, it could be used for modally displayed processes that are dismissed by the user, in which case the dismissRequested(forProcess process: String, navigationController: UINavigationController)
method of the FXDataSource will be called.
action
- the ProcessActionModel
action object
params
- the parameters for the action
action
- the ProcessActionModel
action object
image
- the image to upload
action
- the ProcessActionModel
action object
fileURL
- the local URL of the image
func updateAuthorization(token: String)
method.
FXDataSource
protocol.
The data source is a public property of FlowX shared instance.
public weak var dataSource: FXDataSource?
func controllerFor(componentIdentifier: String) -> FXController?
func viewFor(componentIdentifier: String) -> FXView?
func viewFor(componentIdentifier: String, customComponentViewModel: FXCustomComponentViewModel) -> AnyView?
func navigationController() -> UINavigationController?
UINavigationController
class, or just a regular UINavigationController
instance themed by the container app.
func errorReceivedForAction(name: String?)
func validate(validatorName: String, value: String) -> Bool
func dismissRequested(forProcess process: String, navigationController: UINavigationController)
componentIdentifier
configured in the UI designer.
A custom component received data to populate the view and actions to execute, described in the scenarios below
There are 3 methods to provide a custom component:
internal(set) public var data: [String: Any]?
data
is a dictionary property, containing the data model for the custom component.
internal(set) public var actions: [ProcessActionModel]?
actions
is the array of FlowX actions provided to the custom component.
func titleForScreen() -> String?
func populateUI(data: [String: Any])
func updateUI(data: [String: Any])
controllerFor(componentIdentifier:)
method of the FXDataSource
.
UIView
instances. Similar to FXController
it has data and actions properties and a populate method.
var data: [String: Any]?
data
is a dictionary property containing the data model needed by the custom view.
var actions: [ProcessActionModel]?
actions
is the array of actions provided to the custom view.
func populateUI(data: [String: Any]?)
viewFor(componentIdentifier:)
method of the FXDataSource
.
AnyView
of your SwiftUI view.
In order to receive updates regarding data
and actions
for the component, the FXCustomComponentViewModel
instance should be added as an @ObservedObject
property inside the view.
FXCustomComponentViewModel
is a class implementing the ObservableObject
protocol.
It has two published properties, for data and actions.
viewFor(componentIdentifier:customComponentViewModel:)
method of the FXDataSource
.