Skip to content

Repository files navigation

RKPurchaseKit

Swift Platforms

A lightweight Swift framework for in-app purchases using StoreKit 2
with full support for Swift Concurrency, async/await, and SPM.

📦 Installation

Swift Package Manager

Add this URL to your Xcode project:

https://github.com/Ramiz69/PurchaseKit.git

In Package.swift:

.package(url: "https://github.com/Ramiz69/PurchaseKit.git", from: "3.0.0")

✅ Features

  • async/await API
  • actor-based PurchasesManager
  • DocC documentation
  • Static linking support (type: .static)
  • Support for iOS, macOS, tvOS, watchOS, visionOS (26 and later)

⚠️ Migrating to 3.0

From 2.0 — one change affects you:

  • purchase(productID:) returns a StoreTransaction instead of a raw StoreKit.Transaction. The fields you were reading are on it under the same names, and the raw value is still available as .transaction. StoreKit.Transaction has no public initializer, so while purchase returned one, a stand-in implementation could only throw and never represent a successful purchase — which defeated the point of having a protocol to mock.

From 1.x — everything in 2.0 applies as well:

  • Platforms now start at iOS/macOS/tvOS/watchOS/visionOS 26. Earlier releases are no longer supported; stay on 1.0.6 if you need them.
  • StoreProduct.product is now optional. It is nil on values you build yourself, because StoreKit.Product cannot be constructed outside StoreKit. There is now a public initializer taking the fields directly, so PurchasesProtocol can be mocked in tests and previews.
  • ProductType gained unknown and PurchasesError gained unhandledPurchaseResult. Exhaustive switch statements over either need a new branch. A StoreKit product type this SDK does not recognise now reports unknown instead of silently passing as nonConsumable.
  • purchasedProducts no longer replays past events. Every access returns a fresh stream, so several observers can watch at once — previously two for await loops split the events between them and each missed the rest. Read current state with hasEntitlement(for:) or requestProducts(includingCache:) when a subscriber starts.
  • requestProducts() with no arguments is now a distinct overload on PurchasesProtocol. Calls are unchanged; only a conformer that relied on the default implementation is affected, and that case no longer compiles rather than recursing forever at runtime.
  • PurchasesError now conforms to Equatable and LocalizedError, and PurchasesManager.resolved() returns the singleton by throwing notConfigured instead of trapping like shared.

📚 Documentation

📄 License

MIT © Ramiz Kichibekov

About

A Swift framework that streamlines in-app purchases using StoreKit 2 with SPM and static linking support.

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages