Superwall

PaywallOptions

Configuration for paywall presentation and behavior in the Superwall iOS SDK.

PaywallOptions is provided via the paywalls property on SuperwallOptions and is passed when calling configure.

Purpose

Customize how paywalls look and behave, including preload behavior, alerts, dismissal, and haptics.

Signature

@objcMembers
public final class PaywallOptions: NSObject {
  public var isHapticFeedbackEnabled: Bool = true

  public final class RestoreFailed: NSObject {
    public var title: String = "No Subscription Found"
    public var message: String = "We couldn't find an active subscription for your account."
    public var closeButtonTitle: String = "Okay"
  }
  public var restoreFailed: RestoreFailed = RestoreFailed()

  public var shouldShowWebRestorationAlert: Bool = true

  public final class NotificationPermissionsDenied: NSObject {
    public var title: String = "Notification Permissions Denied"
    public var message: String = "Please enable notification permissions from the Settings app so we can notify you when your free trial ends."
    public var actionButtonTitle: String = "Open Settings"
    public var closeButtonTitle: String = "Not now"
  }
  public var notificationPermissionsDenied: NotificationPermissionsDenied?

  public var shouldShowPurchaseFailureAlert: Bool = true
  public var shouldPreload: Bool = true
  public var automaticallyDismiss: Bool = true

  public var overrideProductsByName: [String: String]? = [:]
  public var shouldShowWebPurchaseConfirmationAlert: Bool = true

  public enum TransactionBackgroundView: Int {
    case spinner
    case none
  }
  public var transactionBackgroundView: TransactionBackgroundView = .spinner
}

Parameters

Prop

Type

Usage

let paywallOptions = PaywallOptions()
paywallOptions.isHapticFeedbackEnabled = true
paywallOptions.shouldShowPurchaseFailureAlert = false
paywallOptions.shouldPreload = true
paywallOptions.automaticallyDismiss = true
paywallOptions.transactionBackgroundView = .spinner
paywallOptions.overrideProductsByName = [
  "primary": "com.example.premium_monthly",
  "tertiary": "com.example.premium_annual"
]
paywallOptions.shouldShowWebRestorationAlert = true
paywallOptions.notificationPermissionsDenied = {
  let n = PaywallOptions.NotificationPermissionsDenied()
  n.title = "Notification Permissions Denied"
  n.message = "Please enable notification permissions from the Settings app so we can notify you when your free trial ends."
  n.actionButtonTitle = "Open Settings"
  n.closeButtonTitle = "Not now"
  return n
}()

let options = SuperwallOptions()
options.paywalls = paywallOptions

Superwall.configure(
  apiKey: "pk_your_api_key",
  options: options
)

How is this guide?

Edit on GitHub