Storekit

up:: iOS Development

This is a fantastic walkthrough: iOS In-App Subscription Tutorial with StoreKit 2 and Swift

iOS Sandbox user

Snippets

// Setup in view
@EnvironmentObject private var purchaseManager: PurchaseManager
 
// check if user has purchased lifetime
if purchaseManager.hasUnlockedLifetime {
	Text("Thank you for purchasing lifetime!")
}

Set up for Preview

struct PreviewPaywallView: View {
    @StateObject private var purchaseManager = PurchaseManager()
 
    var body: some View {
        PaywallView()
            .environmentObject(purchaseManager)
    }
}
 
#Preview {
    PreviewPaywallView()
}