CereSDK

public class CereSDK : NSObject, WKNavigationDelegate
extension CereSDK: WKScriptMessageHandler

Class that provides all the functionality of the Cere SDK.

  • SDK instance

    Declaration

    Swift

    public static let instance: CereSDK
  • Initializes and prepares the SDK for usage.

    Declaration

    Swift

    public func initSDK(appId: String, integrationPartnerUserId: String, controller: UIViewController, token: String = "")

    Parameters

    appId

    identifier of the application from RXB.

    integrationPartnerUserId

    The user’s id in the system.

    controller

    UIViewController where SDK’s WebView will be attached to

    token

    (Optional) User onboarding access token

  • Send event to RXB.

    Declaration

    Swift

    public func sendEvent(eventType: String, payload: String = "")

    Parameters

    eventType

    Type of event. For example APP_LAUNCHED.

    payload

    Optional parameter which can be passed with event.

  • Sets custom size for the widget. Parameters should be specified in percentage of screen bounds.

    Declaration

    Swift

    public func setDisplay(left: CGFloat, top: CGFloat, width: CGFloat, height: CGFloat)
  • Hide SDK view

    Declaration

    Swift

    public func hide()
  • Returns current SDK status

    Declaration

    Swift

    public func getStatus() -> SdkStatus
  • Sets handler that is called when widget is finished initialization.

    Declaration

    Swift

    public func onInitializationFinished(_ handler: @escaping OnInitializationFinishedHandler) -> CereSDK
  • Sets handler that is called when widget is failed to initialize.

    Declaration

    Swift

    public func onInitializationError(_ handler: @escaping OnInitializationErrorHandler) -> CereSDK
  • Handles messages coming from SDK webview

    Declaration

    Swift

    public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)