Displaying No-Codes
First, you need to initialize the SDK. To do this, use the same project key that you use to initialize the Qonversion SDK.
// You can initialize using only project key
let configuration = NoCodes.Configuration(projectKey: "your_project_key")
NoCodes.initialize(with: configuration)
Then you can set the delegates for handling events and customizing screens as follows:
NoCodes.shared.set(delegate: self)
NoCodes.shared.set(screenCustomizationDelegate: self)
// Delegates can be also passed via the initialization throught the configuration:
let configuration = NoCodes.Configuration(projectKey: "your_project_key", delegate: self, screenCustomizationDelegate: self)
After initializing the SDK, you can move forward and display the No-Codes screen:
NoCodes.shared.showNoCode(withContextKey: "your_context_key")
Delegates
Earlier, we discussed how to set delegates. Now, let’s explore their purpose.
Main delegate
The main delegate is needed so that you can receive messages about what is happening during the execution of No-Codes, as well as to provide us with the screen from which to start navigation and display the No-Codes screen. Let’s go through this step by step:
controllerForNavigation
func controllerForNavigation() -> UIViewController?
In this function, you must return a UIViewController from which we will start displaying the No-Codes flow. If you do not provide one, we will take the topmost screen in the current stack.
noCodesHasShownScreen
func noCodesHasShownScreen(id: String)
This function notifies about the display of a screen with a specific identifier
noCodesStartsExecuting
func noCodesStartsExecuting(action: NoCodes.Action)
This function notifies you that executing the action you set up through our dashboard has begun.
noCodesFailedToExecute
func noCodesFailedToExecute(action: NoCodes.Action, error: Error?)
This function notifies you that executing the action you set up through our dashboard has failed.
noCodesFinishedExecuting
func noCodesFinishedExecuting(action: NoCodes.Action)
This function notifies you that the action you set up through our dashboard has been executed.
noCodesFinished
func noCodesFinished()
This function notifies that the NoCodes flow has been completed and NoCodes has been finished.
noCodesFailedToLoadScreen
func noCodesFailedToLoadScreen()
This function is called when NoCodes screen loading failed.
Screen customization delegate
Use this delegate to customize the screen opening animation. For example, to enable or disable the animation, specify the type of opening: push/full screen/popover.
For example:
func presentationConfigurationForScreen(id: String) -> NoCodes.PresentationConfiguration {
return NoCodes.PresentationConfiguration(animated: true, presentationStyle: .push)
}
Updated 1 day ago