Super basic SwiftUI with paywall using RevenueCat

June 23, 2022 ยท View on GitHub

I wanted to show how to make a SwiftUI app that can easily get updated customer info (when purchases are made) to update the user interface to show the newly unlockd content.

  • Listens for CustomerInfo updates using Purchases.shared.customerInfoStream (an AsyncSequence)
  • Updates a @StateObject that is passed as an environment object to children views
  • ContentView will...
    • Display paywall from current Offering if no active entitlements
    • Show a Text (unlocked content) if active entitlements
    • Will update automatically when the customer info environment object is updated

Demo

โš ๏ธ This demo is using an account that is used for lots of sandbox testing so the two "lifetime" packages isn't a bug ๐Ÿ˜› Just something I need to clean up ๐Ÿคทโ€โ™‚๏ธ

https://user-images.githubusercontent.com/401294/175346246-3b975d5f-c18e-40be-98d6-3570d0ff817a.mp4