Skip to content

Commit

Permalink
Fix typo & add note that SwiftUI preview paywall design isn't custom
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Sep 23, 2024
1 parent e046322 commit c14729e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/FreemiumKit/FreemiumKit.docc/SetupGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Sometimes we were using `FreemiumKit.shared` and sometimes `@EnvironmentObject v

The answer is simple: Whenever you are in a **SwiftUI view** and you want your view to **automatically update** based on the purchase state, you should use `@EnvironmentObject`. This will ensure that the SwiftUI rendering picks up changes to the purchase state and refreshes your UI accordingly.

Everywhere else, you can use `FreemiumKit.shared`. For exmaple in your model layer, your user-intitiated functions, or even in one-off modifiers in your views like in `onAppear`.
Everywhere else, you can use `FreemiumKit.shared`. For example in your model layer, your user-intitiated functions, or even in one-off modifiers in your views like in `onAppear`.


## SwiftUI Previews
Expand All @@ -213,6 +213,8 @@ If you want to simulate a specific paid state in your previews, you can call the
}
```

> Note: The paywall UI you will see in SwiftUI previews will not reflect your custom paywall UI due to previews being rendered outside your apps lifecycle. Run your app on device or simulator to see your own paywall.

## Direct Access to StoreKit Transactions

In some advanced use cases, you might want to directly access the transactions reported by `StoreKit` which our SDK is already subscribed to. You can easily get all valid transactions by calling `FreemiumKit.shared.purchasedTransactions` or even subscribe and react to changes in your SwiftUI views:
Expand Down

0 comments on commit c14729e

Please sign in to comment.