Replies: 1 comment
-
When the key does not exist in the UserDefaults dictionary, then the observance does not start. If the value is set for a key, while the app is used, the value is added to the key, and after the app is restarted, the observance succeeds. The solution to this problem is to register default values to be used, if the key can't be found, using https://developer.apple.com/documentation/foundation/userdefaults/1417065-register |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, in my macOS app using TCA, I use the
userDefaults.boolValues
etc. to change the view in other windows when the app settings is changed. I experienced the problem that when it's the first time I am changing the value for a particular key, the other view doesn't receive the value.For example, whenever I change the window background color in the app settings, I expect the other window to change its color immediately. But it doesn't. I restart the app and it gets the latest value (meaning it was set to the user defaults), and from that point forward it is working as expected for each change.
That's why it was really hard to reproduce. As I started to test the app with beta users, they experienced the same issue, and I had to tell them to restart the app.
Has anybody experienced something similar?
Beta Was this translation helpful? Give feedback.
All reactions