Skip to content

Observe outside changes to AppStorage values#515

Draft
kaascevich wants to merge 1 commit into
moreSwift:mainfrom
kaascevich:app-storage-providers
Draft

Observe outside changes to AppStorage values#515
kaascevich wants to merge 1 commit into
moreSwift:mainfrom
kaascevich:app-storage-providers

Conversation

@kaascevich
Copy link
Copy Markdown
Collaborator

@kaascevich kaascevich commented Apr 9, 2026

The title says it all.

Backend-agnostic (and thus works on all backends just realized that UserDefaults does not feature KVO on non-Apple platforms, I’ll have to figure something else out over there).

  • Adds a new requirement to AppStorageProvider:
    func listenToChanges(_ action: @MainActor @Sendable @escaping (String) -> Void)

@kaascevich
Copy link
Copy Markdown
Collaborator Author

If I can get it to work, I may update this so that each individual AppStorage instance registers a listener instead of only one being registered on app startup. That way we won’t have to refresh the entire scene graph every time an external change occurs.

@kaascevich kaascevich marked this pull request as draft April 9, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant