Swiftpack.co - 453jerry/RxStoreKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by 453jerry.
453jerry/RxStoreKit 1.1.0
Reactive extensions of StoreKit(In-App purchase)
⭐️ 3
🕓 1 year ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/453jerry/RxStoreKit.git", from: "1.1.0")

RxStoreKit

swift platform
Reactive extensions of StoreKit

How to use

Request SKProduct

Create observable sequence of responses for SKProductRequest and subscribe it

SKProduct.rx.request(with: ["xxxxx"])
    .subscribe(onNext: { response in
        let products = response.products
    })
    .dispose()

or

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

 SKPaymentQueue.default().rx.updatedTransaction
    .subscribe(onNext: { transaction in
        // Do what you want
    })
    .dispose()

Subscribe product identifiers with revoked entitlements

paymentQueue.rx.productIdentifiersWithRevokedEntitlements
    .subscribe { productIdentifier in
        // Do what you want
    }

GitHub

link
Stars: 3
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Related Packages

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics