Closed ddanilyuk closed 1 month ago
@ddanilyuk This is the expected behavior as of today, and you'll see similar behavior in SwiftUI's @AppStorage
. In order to subscribe to updates we use Notification Center because KVO does not work with user defaults keys that contain periods (e.g. "my.key"
), and Notification Center does not allow for granular subscription per key. As such we just always trigger an update when user defaults update, just like @AppStorage
in SwiftUI.
We are open to improvements here, but we don't consider it a bug, so I'm going to convert this to a discussion.
Description
Found some weird behavior with AppStorageKey. The shared
publisher
is triggered after updating some unrelated UserDefaults values. Here is the XCTest, which is failing but should not.Checklist
main
branch of this package.Expected behavior
No response
Actual behavior
No response
Reproducing project
https://github.com/ddanilyuk/SharedSubscriptionIssue/blob/main/TestSharedSubscriptionTests/TestSharedSubscriptionTests.swift
The Composable Architecture version information
1.15.2
Destination operating system
No response
Xcode version information
16.0
Swift Compiler version information
No response