Migrating From Storekit
The Breeze Swift SDK allows you to migrate from StoreKit with minimal changes. You don't need to change the logic for fetching products and making purchases. You can wrap StoreKit Product to BreezeProduct
and replace StoreKit purchase calls with Breeze purchase calls easily.
Example: Original StoreKit Purchase
func purchase(_ product: Product, onSuccess: (() -> Void)? = nil) async throws {
let result = try await product.purchase()
switch result {
case .success(let verification):
let transaction = try checkVerified(verification)
// YOUR logic to handle successful transaction
onSuccess?.()
await transaction.finish()
return transaction
case .userCancelled, .pending:
return nil
default:
return nil
}
}
Breeze Purchase:
func purchaseBreeze(_ product: Product, onSuccess: (() -> Void)? = nil) async throws {
// wrap Storekit Product to Breeze Product
let breezeProduct = try await Breeze.shared.fromSkProduct(product: product)
try await breezeProduct.purchase(using: Breeze.shared, onSuccess: { verifiedTransaction in
// YOUR logic to handle successful verified transaction
onSuccess?()
await Breeze.shared.finish(verifiedTransaction)
})
}
StoreKit Mapping
Every StoreKit configuration element has a direct counterpart in our SDK:
- Product Identifiers: Preserved exactly as configured in App Store Connect
- Product Types: Consumable, non-consumable, and subscription types supported
- Pricing Tiers: All App Store pricing structures maintained
- Localization: Multi-language support using existing App Store localizations
Sample App
A fully‑worked example is available in the our github
Updated 2 months ago