This article is not available in your language, so the default english version is displayed instead.

#Methods

#init

func init(key: String)

Creates a new Access instance (required to display paywalls) using your app ID.

#createPaywall

func createPaywall(pageType: String? = "page", view: UIView? = nil, percent: Int? = nil, complete: (() -> Void)? = nil) -> Void

Presents a paywall. There are currently two display modes available with this method:
  • Embedded: the paywall is displayed on top of a view of your choice, hiding a certain percentage of it
  • Bottom sheet (experimental): the paywall is displayed on top of the most top-level controller found in your app (rootViewController).

Presentation mode depends on passed parameters: if a view is provided, the paywall will be displayed in embedded mode, otherwise it will be displayed in bottom sheet mode.

#createPaywall

func createPaywall(pageType: String, onFlowComplete: (() -> Void)?) -> UIView?

Presents a paywall in custom mode.
This method returns a UIView object containing the paywall content after its been rendered.

⚠️ The resulting view can be moved or scaled down in width, but will automatically redraw itself to a height that can fit its content. Any attempt at height modification through view frame or constraints will break its layout.

#config

func config(_ config: [String: Any], _ readOnly: Bool = false) -> Void

Allows to set some configuration options. See the configuration options documentation.

#texts

func texts(_ texts: [String: String], _ readOnly: Bool = false) -> Void

Allows to set custom texts all over the paywall. See the texts documentation.

⚠️ Our SDK currently embeds two languages: English and French (defaults to English). If you want to use any other language than the default one, you must add a Localizable.strings file to your project for all the languages you want to support.

#styles

func styles(_ styles: [String: Any], _ readOnly: Bool = false) -> Void

Allows to set custom styles for the default appearance. See the styles documentation.

#variables

func variables(_ variables: [String: Any]) -> Void

Allows to set custom variables to be replaced inside some text keys. See the variables documentation.

#on*

func on*(event: String, callback: @escaping (Event?) -> Void) -> Void

Allows to set a callback to be called when a specific event is triggered (ex: onIdentityAvailable). See the events documentation.

#off

func off(_ event: String) -> Void

Allows to remove a callback previously set with on*. Accepted values for event are:
  • "identityAvailable"
  • "lock"
  • "ready"
  • "paywallSeen"
  • "release"
  • "register"
  • "subscribeClick"
  • "loginClick"
  • "discoveryLinkClick"
  • "alternativeClick"
  • "error"
  • "dataPolicyClick"
  • "formSubmit"
  • "answer"
  • "customButtonClick"

#setDebug

static func setDebug(_ enabled: Bool)

Enables/Disables debugging for all Access instances.