StoreKitHelper

StoreKitHelper

StoreKit 2 wrapper for SwiftUI

Description

Adding in-app purchases to an iOS or Mac app means a pile of StoreKit 2 boilerplate: loading products, listening for transactions, verifying them, restoring purchases, and then explaining to a user why their second Mac says they never paid. StoreKitHelper packs all of that into a small SwiftUI-friendly library. Inject one StoreContext at your app entry point and read purchaseStatus to decide whether to show the full app or the paywall.

The author runs more than a dozen of his own Mac apps on it, and it ships the paywall, plan picker and restore button UI too, so an indie developer can wire up purchases in an afternoon instead of a week. Version 2.10 adds Apple's new multi-seat subscriptions, letting one buyer pay for a whole team on a single product.

Features



Three clear states: purchaseStatus is just loading, purchased or not purchased, so a SwiftUI view can switch on it directly.

Ready-made paywalls: StoreKitHelperView and StoreKitHelperSelectionView give you unlock-everything and plan-picker popups, configured through a chainable API for pricing copy, terms and privacy buttons.

Live transaction tracking: listens for transaction updates in the background, so purchases, refunds and renewals refresh the state on their own.

Purchases survive new devices: when the local entitlement cache is empty it checks the latest transaction and retries a few seconds after launch, so a second Mac no longer shows the app as unpaid.

Multi-seat subscriptions: since v2.10, buy a subscription for a group by passing the total seat count, up to 100, and raise the total to add people.

Offer code redemption: built-in entry to Apple's offer code sheet, with entitlements refreshed after redemption.

Pass-through purchase options: purchase accepts native StoreKit options such as appAccountToken to tie purchases to your own accounts.

Protocol-based products: declare product IDs through the InAppProduct protocol so typos surface at compile time, backed by a full test suite.