sindresorhus / Defaults

💾 Swifty and modern UserDefaults
https://swiftpackageindex.com/sindresorhus/Defaults/documentation/defaults
MIT License
1.97k stars 117 forks source link

SwiftUI @Default(.key) not updating across multiple views. #103

Closed RoyRao2333 closed 2 years ago

RoyRao2333 commented 2 years ago

Here are the code snippets:

image image image

As you can see, parent view and child view are both containing a private firstLaunch property. However, when child view changes the firstLaunch to false, parent view is not updating. Although it do changed the value of this key in UserDefault since it shows HomeView on App's second launch...

I'm using the latest release of Defaults (6.2.1). Don't know if my usage is wrong? I do remember this can work in my previous projects.😂

sindresorhus commented 2 years ago

Duplicate of #59