Screen · Commerce
StoreKit 2 Paywall SwiftUI Screen
A polished SwiftUI paywall you can drop into your app and make your own. Swap the plans, restyle the layout, and connect it to StoreKit. It includes StoreKit 2 products, intro offers, purchase and restore, a transaction listener, a designed error state and a success moment before unlock.
A complete StoreKit 2 paywall: loading skeleton, intro offers, purchase, restore, a transaction listener, a designed error state and a success moment before unlock.
- SwiftUI
- iOS 17.0+
- glass-paywall-screen
$199 once, every piece included. See how installing works · Sign in
01
What's included
SwiftUI source you own, built on Apple frameworks only.
- StoreKit 2 products, intro offers, purchase and restore
- A transaction listener
- A designed error state
- A success moment before unlock
- Built on the Paywall screen
Includes
Paywall. Installed together, automatically.
Requires
In-App Purchase capability
In the Build Kit
Subscription Utility (brief), Onboarding to Paywall (recipe). Your agent builds around this screen in the same design.
Used in
Subscription App (template), Meditation App (template), Travel App (template), Sleep App (template), Smart Home App (template), Weather App (template), Meal Planner (template), Fitness App (template)
02
Implementation notes
How it behaves, what it handles, and the decisions behind it.
Loads products with Product.products(for:), maps them to PaywallPlan including eligible free-trial intro offers, purchases with verification, restores with AppStore.sync() and Transaction.currentEntitlements, and keeps a Transaction.updates listener running so Ask to Buy, renewals and purchases on other devices are finished and unlock the app. While loading, the Paywall screen shows skeleton cards; a load failure shows a designed retry card; purchase failures surface inline through PaywallStatus. A verified unlock plays a brief ring-and-check moment before onUnlocked fires.
Notes
PaywallModelis an@Observable@MainActorclass you can drive from tests without the view.- Pass
onDismisswhen the screen is embedded (for example insideOnboardingFlowScreen) rather than presented. GlassPaywallScreenExampleat the end ofGlassPaywallScreen.swiftis the screen shown in the preview; copy it as a starting point.
Theming
- Reads
SPThemefrom@Environment(\.spTheme)and requires thedesign-systemitem. The theme flows intoGlassPaywallBlockthrough the environment, so one assignment styles both. - The background runs from
accentat 45% tobg. The hero tile, close button and load-error card usespGlass, which turns opaquesurfaceElevatedunder Reduce Transparency. - The success moment draws its ring and check in
accent; "Try again" usesaccentwithaccentOntext.
Requirements
- In-App Purchase capability.
- Products in App Store Connect matching
productIDs.
03
Keep building
Pieces that work well next to this one.