Build a SwiftUI Paywall: StoreKit 2 Subscriptions Tutorial (2026)
Build a fully custom SwiftUI paywall from scratch using StoreKit 2 - no third-party SDKs required. This is the zero-to-hero, code-along tutorial that finally answers the most-requested topic on this channel. You'll build a production-ready iOS paywall with monthly and yearly subscription options, a working purchase flow, transaction verification, and restore purchases - all with native StoreKit 2 APIs and modern SwiftUI. ⭐ GitHub Repo: https://github.com/NDCSwift/PaywallDemo_SwiftUI 📌 What you'll build: — Custom SwiftUI paywall UI — StoreKit 2 SubscriptionManager with @Observable — Product fetching, purchase flow, and transaction verification — Restore Purchases support — Local StoreKit config testing (simulator, no Apple ID needed) — Sandbox Apple ID testing on a real device (the way Apple Review tests it) — 4 Paywall patterns used in real apps (Hard Feature Gate, Usage Limit Gate, Content Gate, Soft Nudge) TestFlight Guide: https://youtu.be/x0d8Jx3HvdI ⏱️ Timestamps: 00:00 — Intro & What We're building 02:00 — Project setup 02:21 — StoreKit configuration file for local testing 03:53 — Creating Subscription Group + Subscriptions 06:00 — Update Scheme to use StoreKit Config (Local testing) 07:05 — Building the SubscriptionManager (StoreKit 2) 11:07 — Fetching Products Function 12:49 — Purchase Function 14:55 — Restore Purchase Function 15:48 — Active Subscription Check 16:15 — Update Purchased Products Function 18:03 — Check Verification Function 19:36 — Listen for Transactions Function 20:59 — Quick Bug Fixes / Error Fixes 21:31 — Subscription Manager Overview 22:28 — Building the PaywallView in SwiftUI 27:02 — Handling Subscription Display & Purchase 34:15 — Injecting Store at Entry Point 34:56 — Wiring the paywall into your app 37:05 — Testing the full purchase flow in the simulator (Local testing) 38:44 — Why Sandbox testing + how Apple reviews subscriptions 39:17 — TestFlight Testing 39:45 — Setting up Sandbox Account 40:50 — Sandbox Account on Physical Device (iPhone) 41:46 — Creating Subscriptions on App Store Connect 45:17 — Submitting Subscriptions & IAP's for review 46:10 — Syncing StoreKit and App Store Connect (optional) 46:30 — Editing Scheme for Sandbox 47:00 — Testing Sandbox on Physical Device (iPhone) 48:08 — Additional Store Settings & Purchase options for Testing 49:30 — StoreKit Debug (Manually updating Subscriptions) 50:35 — 4 Paywall methods explained & Updating Subscription Manager 52:03 — Paywall #1: Hard Feature Gate 54:32 — Paywall #2: Usage Limit Gate 57:07 — Paywall #3: Content Gate 1:01:09 — Paywall #4: Soft Nudge 1:04:14 — Additional suggestions for using Paywalls 1:04:59 — GitHub Extras with Advanced Views (Repo in desc) #SwiftUI #iOSDevelopment #StoreKit2 #iOSPaywall #SwiftUITutorial
Download
0 formatsNo download links available.