https://github.com/453jerry/rxstorekit
Reactive extensions of StoreKit(In-App purchase)
https://github.com/453jerry/rxstorekit
iap in-app-purchase reactive reactivex rxswift storekit swift
Last synced: 4 months ago
JSON representation
Reactive extensions of StoreKit(In-App purchase)
- Host: GitHub
- URL: https://github.com/453jerry/rxstorekit
- Owner: 453jerry
- License: mit
- Created: 2023-01-13T16:31:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-27T15:48:29.000Z (over 3 years ago)
- Last Synced: 2026-02-03T04:05:49.097Z (4 months ago)
- Topics: iap, in-app-purchase, reactive, reactivex, rxswift, storekit, swift
- Language: Swift
- Homepage:
- Size: 25.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RxStoreKit
[](https://swiftpackageindex.com/453jerry/RxStoreKit)
[](https://swiftpackageindex.com/453jerry/RxStoreKit)
Reactive extensions of StoreKit
## How to use
### Request SKProduct
Create observable sequence of responses for SKProductRequest and subscribe it
``` swift
SKProduct.rx.request(with: ["xxxxx"])
.subscribe(onNext: { response in
let products = response.products
})
.dispose()
```
or
```swift
let request = SKProductsRequest.init(productIdentifiers: ["product_id"])
request.rx.response.subscribe { event in
switch event {
case .next(let response):
let products = response.products
default:
return
}
}
.dispose()
```
### Subscribe update payment transactons
```swift
SKPaymentQueue.default().rx.updatedTransaction
.subscribe(onNext: { transaction in
// Do what you want
})
.dispose()
```
### Subscribe product identifiers with revoked entitlements
```swift
paymentQueue.rx.productIdentifiersWithRevokedEntitlements
.subscribe { productIdentifier in
// Do what you want
}
```