Skip to main content

Hey everyone,

I am struggling how to unlock premium content after successful transaction. Based on docs and github a came up with :

            Purchases.shared.getCustomerInfo { (info, error) in

                guard let info = info, error == nil else { return }

                if info.entitlements.all "allaccess"]?.isActive == true{

                    //pro content here

                } else {

                    //free content

                }

            }

        }

but it throws errors at does not seems like to work.

I have RC 4.0.0

 

Thanks for helping:)

Hey @Filip Vlcek!

I’d recommend creating a view model to store your latest CustomerInfo to reference from your SwiftUI views. You can see an example of this in our SwiftUI sample here: https://github.com/RevenueCat/purchases-ios/tree/main/Examples/MagicWeatherSwiftUI


Reply