Background
Get set up with the Helium SDK for iOS. Reach out over your Helium slack channel or email [email protected] for any questions.Installation
Helium requires a minimum deployment target of iOS 15 and Xcode 14+. (Latest Xcode is recommended.)
- Swift Package Manager (SPM)
- Cocoapod
-
In Xcode, navigate to your project’s Package Dependencies:

-
Click the + button and search for the Helium package URL:
- Click Add Package.
-
In the dialog that appears, make sure to add the Helium product to your app’s main target:

- (Optional) If you are using RevenueCat to manage purchases, we recommended you also add HeliumRevenueCat to your target so that you can use our RevenueCatDelegate referenced in the Purchase Handling section of this guide. Otherwise leave as None for the HeliumRevenueCat row.
- Select Add Package in the dialog and Helium should now be ready for import.
Initialize Helium
Initialize the Helium SDK as early as possible in your app’s lifecycle. Choose the appropriate location based on your app’s architecture:- SwiftUI
- SceneDelegate
- AppDelegate
Helium’s initialization is ran on a background thread, so you don’t have to worry about it affecting your app’s launch time.
Custom User ID and Custom User Traits
Custom User ID and Custom User Traits
You can provide a custom user ID and custom user traits in the
initialize method or by using Helium.shared.overrideUserId. Set the user ID and traits before or during initialize to ensure consistency in analytics events and for the best experimentation results.Checking Download Status
Checking Download Status
In most cases there is no need to check download status. Helium will display a loading indication if a paywall is presented before download has completed.
Helium.shared.getDownloadStatus() method. This method returns a value of type HeliumFetchedConfigStatus, which is defined as follows:Helium.shared.paywallsLoaded().Presenting Paywalls
You must have a trigger and workflow configured in the dashboard in order to show a paywall.
Helium.shared.presentUpsell(trigger:) when you want to show the paywall. For example:
Looking for alternative presentation methods? Check out the guide on Ways to Show a Paywall.
PaywallEventHandlers
When displaying a paywall you can pass in event handlers to listen for relevant Helium Events. You can chain a subset of handlers with builder syntax:Usage Suggestions:
- Use
onDismissfor post-paywall navigation when the paywall is dismissed but a user’s entitlement hasn’t changed - Use
onPurchaseSucceededfor your post purchase flow (e.g., a premium onboarding navigation) - Use
onCloseto handle a paywall close, regardless of reason
Purchase Handling
Use (or subclass) one of our pre-builtHeliumPaywallDelegate implementations or create a custom delegate. Pass the delegate in to your Helium.shared.initialize call.
- StoreKitDelegate
- RevenueCatDelegate
- Custom Delegate
The StoreKitDelegate (default delegate) handles purchases using native StoreKit 2:
Listen for Helium Events
Helium Events are emitted by Helium for various paywall actions, purchase completions, and more. Options to listen for these events include:1. onPaywallEvent of HeliumPaywallDelegate
Subclass one of the providedHeliumPaywallDelegate implementations (see Purchase Handling section above) and override onPaywallEvent:
Make sure to pass your delegate in to
Helium.shared.initialize!2. Add a HeliumEventListener
3. Use PaywallEventHandlers for paywall-specific events
See the section titled PaywallEventHandlers on this page.Checking Subscription Status & Entitlements
The Helium SDK provides several ways to check user entitlements and subscription status.Entitlement Helper Methods
Entitlement Helper Methods
hasAnyEntitlement() Checks if the user has purchased any subscription or non-consumable product.hasAnyActiveSubscription(includeNonRenewing: Bool = true) Checks if the user has any active subscription. Set includeNonRenewing to false to check only auto-renewing subscriptions.hasEntitlementForPaywall(trigger: String, considerAssociatedSubscriptions: Bool = false) Checks if the user has entitlements for any product in a specific paywall. Returns nil if paywall configuration hasn’t been downloaded yet.hasActiveEntitlementFor(productId: String) Checks if the user has entitlement to a specific product.hasActiveSubscriptionFor(productId: String) Checks if the user has an active subscription for a specific product.hasActiveSubscriptionFor(subscriptionGroupID: String) Checks if the user has an active subscription in a specific subscription group.purchasedProductIds() Retrieves a list of all product IDs the user currently has access to.activeSubscriptions() Returns detailed information about all active auto-renewing subscriptions.subscriptionStatusFor(productId: String) Gets detailed subscription status for a specific product, including state information like subscribed, expired, or in grace period.subscriptionStatusFor(subscriptionGroupID: String) Gets detailed subscription status for a specific subscription group.Example Usage
Fallbacks and Loading Budgets
If a paywall has not completed downloading when you attempt to present it, a loading state can show. By default, Helium will show this loading state as needed (a shimmer view for up to 7 seconds). You can configure, turn off, or set trigger-specific loading budgets. If the budget expires before the paywall is ready, a fallback paywall will show if available otherwise the loading state will hide and a PaywallOpenFailed event will be dispatched. The iOS sdk has 3 options for fallbacks:- Fallback bundles
- Default fallback view
- Fallback view per trigger
HeliumFallbackConfig object passed in to initialize. Here are some examples:
Advanced
Get Paywall Info By Trigger
Get Paywall Info By Trigger
Retrieve basic information about the paywall for a specific trigger with
Helium.shared.getPaywallInfo(trigger: String) which returns:Reset Helium
Reset Helium
Reset Helium entirely so you can call initialize again. Only for advanced use cases.