Fetching Paywalls & ViewConfiguration

If you have already configured a visual representation for your paywall in Adapty Dashboard, you then need to load the paywall object and its view configuration.

Paywall can be obtained in the way you are already familiar with:

Adapty.getPaywall("YOUR_PAYWALL_ID") { result in
    switch result {
    case let .success(paywall):
        // handle the error
    case let .failure(error):
        self?.paywallsStates[id] = .failed(error)
    }
}

After fetching the paywall call the AdaptyUI.getViewConfiguration(paywall:) method to load the view configuration:

import Adapty

AdaptyUI.getViewConfiguration(paywall: paywall) { result in
    switch result {
    case let .success(viewConfiguration):
        // use loaded configuration
    case let .failure(error):
        // handle the error
    }
}

Once you have successfully loaded the paywall and view configuration, you can proceed to displaying the visual paywall.