SuperwallOptions
A configuration class for customizing paywall appearance and behavior.
Only modify networkEnvironment
if explicitly instructed by the Superwall team. Use .release
(default) for production apps.
Use different SuperwallOptions
configurations for debug and release builds to optimize logging and behavior for each environment.
The SDK automatically chooses StoreKit 2 on iOS 15+ and falls back to StoreKit 1 on older versions, but you can override this with storeKitVersion
.
Purpose
Configures various aspects of Superwall behavior including paywall presentation, networking, logging, and StoreKit version preferences.
Signature
@objcMembers
public final class SuperwallOptions: NSObject {
public var paywalls: PaywallOptions
public var storeKitVersion: StoreKitVersion
public var networkEnvironment: NetworkEnvironment
public var logging: LoggingOptions
public var localeIdentifier: String?
}
Parameters
Property | Type | Description |
---|---|---|
paywalls | PaywallOptions | Configuration for paywall appearance and behavior. |
storeKitVersion | StoreKitVersion | Preferred StoreKit version (.storeKit1 or .storeKit2 ). Defaults to StoreKit 2 on iOS 15+. |
networkEnvironment | NetworkEnvironment | Network environment (.release , .releaseCandidate , .developer , .custom(String) ). Use only if instructed by Superwall team. |
logging | LoggingOptions | Logging configuration including level and scopes. |
localeIdentifier | String? | Override locale for paywall localization (e.g., "en_GB"). |
Returns / State
This is a configuration object used when calling configure()
.
Usage
Basic options setup:
let options = SuperwallOptions()
// Configure paywall behavior
options.paywalls.shouldShowPurchaseFailureAlert = false
options.paywalls.shouldAutoShowPurchaseLoadingIndicator = true
options.paywalls.automaticallyDismiss = true
// Set StoreKit version preference
options.storeKitVersion = .storeKit2
// Configure logging
options.logging.level = .warn
options.logging.scopes = [.superwallCore, .paywallViewController]
// Set locale for testing
options.localeIdentifier = "en_GB"
// Use with configure
Superwall.configure(
apiKey: "pk_your_api_key",
options: options
)
PaywallOptions configuration:
let paywallOptions = PaywallOptions()
// Presentation behavior
paywallOptions.shouldShowPurchaseFailureAlert = false
paywallOptions.shouldAutoShowPurchaseLoadingIndicator = true
paywallOptions.automaticallyDismiss = true
// Transaction behavior
paywallOptions.transactionTimeout = 30.0 // seconds
paywallOptions.restoreFailedPurchaseAlert.title = "Restore Failed"
paywallOptions.restoreFailedPurchaseAlert.message = "Please try again"
// Assign to main options
options.paywalls = paywallOptions
Logging configuration:
let loggingOptions = LoggingOptions()
loggingOptions.level = .debug
loggingOptions.scopes = [.all] // or specific scopes like [.superwallCore, .network]
options.logging = loggingOptions
Real-world example for production:
func configureSuperwallForProduction() {
let options = SuperwallOptions()
// Minimal logging for production
options.logging.level = .error
// Customize paywall behavior
options.paywalls.shouldShowPurchaseFailureAlert = true
options.paywalls.automaticallyDismiss = true
// Use StoreKit 2 for better performance on iOS 15+
options.storeKitVersion = .storeKit2
Superwall.configure(
apiKey: "pk_your_production_api_key",
options: options
)
}
Debug configuration for development:
func configureSuperwallForDebug() {
let options = SuperwallOptions()
// Verbose logging for debugging
options.logging.level = .debug
options.logging.scopes = [.all]
// Show detailed error alerts
options.paywalls.shouldShowPurchaseFailureAlert = true
// Test with specific locale
options.localeIdentifier = "es_ES"
Superwall.configure(
apiKey: "pk_your_test_api_key",
options: options
)
}
How is this guide?