All Projects → glassonion1 → Rxstorekit

glassonion1 / Rxstorekit

Licence: mit
StoreKit library for RxSwift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Rxstorekit

Rxswift
Reactive Programming in Swift
Stars: ✭ 21,163 (+21944.79%)
Mutual labels:  rxswift, observer, reactivex, functional
minimalist
Observable Property and Signal for building data-driven UI without Rx
Stars: ✭ 88 (-8.33%)
Mutual labels:  observer, rxswift
Rxkingfisher
Reactive extension for the Kingfisher image downloading and caching library
Stars: ✭ 190 (+97.92%)
Mutual labels:  rxswift, reactivex
BringMyOwnBeer-
PunkAPI(BrewDog) 을 이용한 RxSwift-MVVM 예제 (Naver Tech Concert)
Stars: ✭ 80 (-16.67%)
Mutual labels:  reactivex, rxswift
SwiftObserver
Elegant Reactive Primitives for Clean Swift Architecture #NoRx
Stars: ✭ 14 (-85.42%)
Mutual labels:  observer, rxswift
Observable
The easiest way to observe values in Swift.
Stars: ✭ 346 (+260.42%)
Mutual labels:  observer, functional
Rxswift Chinese Documentation
RxSwift 中文文档
Stars: ✭ 1,107 (+1053.13%)
Mutual labels:  rxswift, reactivex
Fantas Eel And Specification
Examples and exercises from the blog series
Stars: ✭ 77 (-19.79%)
Mutual labels:  functional
Nano Style
React functional CSS-in-JS
Stars: ✭ 85 (-11.46%)
Mutual labels:  functional
Suave
Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.
Stars: ✭ 1,196 (+1145.83%)
Mutual labels:  functional
Cleverbot
iOS Messaging Application using Cleverbot and ReactorKit
Stars: ✭ 74 (-22.92%)
Mutual labels:  rxswift
Ease
It's magic.
Stars: ✭ 1,213 (+1163.54%)
Mutual labels:  observer
Html
A Virtual DOM based templating-engine for PHP
Stars: ✭ 86 (-10.42%)
Mutual labels:  functional
Oh
A new Unix shell.
Stars: ✭ 1,206 (+1156.25%)
Mutual labels:  functional
Fuego
Functional Experiment in Golang
Stars: ✭ 87 (-9.37%)
Mutual labels:  functional
Rxkotlinfx Tornadofx Demo
A demo application demonstrating TornadoFX and Rx usage
Stars: ✭ 75 (-21.87%)
Mutual labels:  reactivex
Qiitawithfluxsample
A sample project uses Flux and MVVM features with RxSwift.
Stars: ✭ 94 (-2.08%)
Mutual labels:  rxswift
Funcy.js
funcy.js - a functional web components wrapper
Stars: ✭ 87 (-9.37%)
Mutual labels:  functional
Rxcommon
Multiplatform implementation of ReactiveX providing a common way to build one set of business logic for native, iOS, Javascript, Android, JVM, and other platforms.
Stars: ✭ 83 (-13.54%)
Mutual labels:  reactivex
Fantasy Land
Specification for interoperability of common algebraic structures in JavaScript
Stars: ✭ 9,209 (+9492.71%)
Mutual labels:  functional

RxStoreKit

RxStoreKit is lightweight and easy to use Rx support for StoreKit(In-App Purchases).

Usage

Request Products

import StoreKit
import RxSwift
import RxStoreKit

let disposeBag = DisposeBag()

let productRequest = SKProductsRequest(productIdentifiers: Set(["your app product id"]))
productRequest.rx.productsRequest
    .subscribe(onNext: { product in
        print(product)
    }).disposed(by: disposeBag)
productRequest.start()

Restore Transactions

SKPaymentQueue.default().rx.restoreCompletedTransactions()
    .subscribe(onNext: { queue in
        // paymentQueueRestoreCompletedTransactionsFinished
        print(queue)
    }, onError: { error in
        // restoreCompletedTransactionsFailedWithError
        print(queue)
    }).disposed(by: disposeBag)

Request payment

let productRequest = SKProductsRequest(productIdentifiers: Set(["xxx.xxx.xxx"]))
productRequest.rx.productsRequest
    .flatMap { response -> Observable<SKProduct> in
        return Observable.from(response.products)
    }
    .flatMap { product -> Observable<SKPaymentTransaction> in
        return SKPaymentQueue.default().rx.add(product: product)
    }
    .subscribe(onNext: { transaction in
        print(transaction)
    }).disposed(by: disposeBag)
productRequest.start()

Request receipt refresh

let receiptRefreshRequest = SKReceiptRefreshRequest()
receiptRefreshRequest.rx.request
    .subscribe(onCompleted: {
        // Refreshed receipt is available
    }, onError: { error in
        print(error)
    }).disposed(by: disposeBag)
receiptRefreshRequest.start()

Download hosting contents

Download In-App Purchase Contents

let productRequest = SKProductsRequest(productIdentifiers: Set(["xxx.xxx.xxx"]))
productRequest.rx.productsRequest
    .flatMap { response -> Observable<SKProduct> in
        return Observable.from(response.products)
    }
    .flatMap { product -> Observable<SKPaymentTransaction> in
        return SKPaymentQueue.default().rx.add(product: product)
    }
    .flatMap { transaction -> Observable<SKDownload> in
        return SKPaymentQueue.default().rx.start(downloads: transaction.downloads)
    }
    .subscribe(onNext: { download in
        print(download)
    }).disposed(by: disposeBag)
productRequest.start()

Installation

This library depends on both RxSwift and RxCocoa

Swift Package Manager

Create a Package.swift file.

import PackageDescription

let package = Package(
  name: "RxTestProject",
  dependencies: [
    .package(url: "https://github.com/glassonion1/RxStoreKit.git", from: "1.3.0")
  ],
  targets: [
    .target(name: "RxTestProject", dependencies: ["RxStoreKit"])
  ]
)

License

RxStoreKit is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].