configure()
A static function that configures a shared instance of Superwall for use throughout your app.
This is a static method called on the Superwall class itself, not on the shared instance.
Purpose
Configures the shared instance of Superwall with your API key and optional configurations, making it ready for use throughout your app.
Signature
public static func configure(
apiKey: String,
purchaseController: PurchaseController? = nil,
options: SuperwallOptions? = nil,
completion: (() -> Void)? = nil
) -> SuperwallParameters
Prop
Type
Returns / State
Returns the configured Superwall instance. The instance is also accessible via Superwall.shared.
Usage
Basic configuration:
Superwall.configure(apiKey: "pk_your_api_key")With custom options:
let options = SuperwallOptions()
options.paywalls.shouldShowPurchaseFailureAlert = false
Superwall.configure(
apiKey: "pk_your_api_key",
options: options
) {
print("Superwall configured successfully")
}With custom purchase controller:
Superwall.configure(
apiKey: "pk_your_api_key",
purchaseController: MyPurchaseController()
)How is this guide?
Edit on GitHub