Created
June 18, 2019 09:53
-
-
Save ren6/643c22c62f0fd1b2a9e2dd39834e1af8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func purchaseProduct(product : SKProduct, success: @escaping SuccessBlock, failure: @escaping FailureBlock){ | |
guard SKPaymentQueue.canMakePayments() else { | |
return | |
} | |
guard SKPaymentQueue.default().transactions.last?.transactionState != .purchasing else { | |
return | |
} | |
self.successBlock = success | |
self.failureBlock = failure | |
let payment = SKPayment(product: product) | |
SKPaymentQueue.default().add(payment) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment