WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

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.

1      

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

1      

HWS+ is doing this woth part 1 out now.

1      

Signed up!

1      

Save 50% in my Black Friday sale.

SAVE 50% To celebrate WWDC22, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.