Purchases.shared.delegate = self
extension YourClass: PurchasesDelegate {
func purchases(_ purchases: Purchases, receivedUpdated customerInfo: Purchases.CustomerInfo) {
if let entitlement = customerInfo.entitlements["your_entitlement_id"] {
if entitlement.isActive == false {
// subscription has expired
print("Subscription has expired")
} else {
// subscription is active
print("Subscription is active")
}
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter