iOS – Presenting visual paywalls

In order to display the visual paywall on the device screen, you must first configure it. To do this, call the method .paywallController(for:products:viewConfiguration:delegate:):

import Adapty
import AdaptyUI

let visualPaywall = AdaptyUI.paywallController(
    for: <paywall object>,
    products: <paywall products array>,
    viewConfiguration: <LocalizedViewConfiguration>,
    delegate: <AdaptyPaywallControllerDelegate>,
    tagResolver: <dictionary of custom tags and their values>
)

Request parameters:

  • Paywall (required) : an AdaptyPaywall object, for which you are trying to get a controller.
  • Products (optional): an AdaptyPaywallProducts array. Pass this value in order to optimize the display time of the products on the screen. If you pass nil, AdaptyUI will automatically fetch the required products.
  • ViewConfiguration (required): an AdaptyUI.LocalizedViewConfiguration object containing information about the visual part of the paywall. To load it, use the AdaptyUI.getViewConfiguration(paywall:locale:) method. Read more.
  • Delegate (optional): an AdaptyPaywallControllerDelegate, for listening paywall events. Read more.
  • TagResolver (optional): dictionary of custom tags and their resolved values. Custom tags are placeholders in the paywall content that can be dynamically replaced with specific strings. This allows for personalized content within the paywall. Read more.

Returns:

  • an AdaptyPaywallController object, representing the requested paywall screen.

After the object has been successfully created, you can display it on the screen of the device:

present(visualPaywall, animated: true)