-
DescriptionRecently, we were attempting to use While tracing down this issue, we found that it was due to the implementation of The documentation points to KVO as the solution for observing changes even across processes, but it has the very annoying issue that keys with periods won't work due to key paths using periods differently. I tried a solution of this nature and failed on the included test with a key containing periods. So I'm not sure what the correct answer is here, but I think it is somewhat expected that Checklist
Expected behavior
Actual behavior
Reproducing projectNo response The Composable Architecture version information
Destination operating systemiOS 18 Xcode version informationXcode 16 Swift Compiler version informationswift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @bcapps, thanks for raising this. This is kind of a known issue at the moment but we're not sure the right way to proceed given the underlying behavior of user defaults. We've chosen the firehose subscription to Notification Center route so that keys like I'd be curious if you've explored the behavior of Now one thing we could explore is a "hybrid" solution of sorts, where if the key contains a period we do a firehose subscription, and otherwise we do a direct KVO subscription. This is of course a tricky line to walk, though, where the format of the key leads to a completely different code path, and so we're not sure it's advisable, and we'd need to be careful to document the difference. Ideally user defaults would provide a better universal solution here, but we're not aware of it. One option you have would be to copy and paste the source of For now I'm going to convert this to a discussion since it is the current expected behavior, but we are open to better solutions here if anyone has ideas. |
Beta Was this translation helpful? Give feedback.
-
Hi @bcapps, as of 1.16 of the library |
Beta Was this translation helpful? Give feedback.
Hi @bcapps, as of 1.16 of the library
@Shared
should now work cross-process (e.g. widgets), as long as your keys do not contain "." or "@".