Hello Claude31
Xcode has this cool feature to see your custom view, while you're creating it.
You can also create multiple previews with different data to see all cases at once without starting your app to test them.
The simulator shows one state of your app, what means that you have to navigate each time to the view your testing and you have to play through all variations, what is quite time consuming.
Therefore I prefer a solution with multiple previews that have different UserDefaults.
Post
Replies
Boosts
Views
Activity
Hello Jackson-G
Thank you for your soon answer.
I tried to adapt your example for UserDefaults. But I could not find a predefined KeyPath for UserDefaults.
In the documentation of EnvironmentValues I could find Locale (which you use in your example), but I could not find a KeyPath for UserDefaults.
Have you maybe a code snippet of your example, which works with UserDefaults?
Here's the documentation I mentioned above: https://developer.apple.com/documentation/swiftui/environmentvalues.