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")
// or also set delegates if neeeded
let configuration = NoCodes.Configuration(projectKey: "your_project_key", delegate: self, screenCustomizationDelegate: self)
NoCodes.initialize(with: configuration)

If you didn't set the delegates during initialization, you can do it later using those functions:

NoCodes.shared.set(delegate: self)
NoCodes.shared.set(screenCustomizationDelegate: self)

After initializing the SDK, you can move forward and display the No-Codes screen:

NoCodes.shared.showNoCode(with: "your_screen_id")

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.

noCodesShownScreen
func noCodesShownScreen(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.

noCodesFailedExecuting

func noCodesFailedExecuting(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.

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)
}