NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

Subscriptions and unlocking the UI

Forums > iOS

How would one set up their app so they can unlock UI items once a subscription is purchased? I am looking at Revenuecat to handle subs, but I would like to know what the best practices are around setting up your UI (I'm using SwiftUI btw), so that once the sub is processed, a) the app remembers this and b) makes previously locked UI elements available to the user.

   

So in Revenuecat docs, there's this bit about checking if a user is subscribed. Is it safe to assume that I could simply set a var to true here, and then reference it anywhere in the app to make items visible/available?

if purchaserInfo.entitlements["your_entitlement_id"]?.isActive == true { // user has access to "your_entitlement_id"
}

https://docs.revenuecat.com/docs/purchaserinfo

   

HWS+ is doing this woth part 1 out now.

   

Hacking with Swift is sponsored by Stream

SPONSORED Check out Stream's cross-platform open source chat SDK on GitHub! Write once and deploy your app with fully featured chat UI on iOS and macOS.

Go to GitHub

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.