Swift In-App Purchase Manager for iOS
Easy-to-use a singleton class that supports non-renewable in-app purchases.
It's super cool because
- it's written in Swift
- it uses blocks!
If you want to make a purchase, all you need to do is to call a method:
IAPManager.shared.purchaseProduct(productId: productId){(error)->Voidinif error ==nil{
// successful purchase!
}else{
// something wrong.. }}You can call purchaseProductWithId without first loading products info because inside purchaseProductWithId it'll load it if needed. So just call purchaseProductWithId whenever you want to make a purchase.
But if you need to get all products info, you can load it by calling:
IAPManager.shared.loadProducts(productIds:[]){(products, error)in}To check if a product was purchased, call (it returns Bool):
IAPManager.shared.isProductPurchased(productId)To restore transactions call:
IAPManager.shared.restoreCompletedTransactions{(error)in}or using CocoaPods
pod 'IAPurchaseManager'
If you are using Swift 2.x, then
pod 'IAPurchaseManager', '~> 0.0.2'
github "Vitaa/IAPurchaseManager"
If you want to add validation, keychain support or some other features, feel free to send me pull requests!