We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basically the same issue as with not being able to use @AppStorage inside @observable (workaround for @AppStorage was suggested here https://medium.com/@davidsteppenbeck/accessing-userdefaults-within-observable-classes-in-ios-17-8cb46ca75689)
The text was updated successfully, but these errors were encountered:
It is correct that @CloudStorage currently doesn't work inside @Observable, same as @AppStorage.
@CloudStorage
@Observable
@AppStorage
Same as with AppStorage, you can workaround this by manually implementing a getter and setter for a property:
@Observable @MainActor class ViewModel { var progress: Double? { get { access(keyPath: \.progress) return CloudStorageSync.shared.double(for: "progress") } set { withMutation(keyPath: \.progress) { CloudStorageSync.shared.set(newValue, for: "progress") } } } }
Sorry, something went wrong.
No branches or pull requests
Basically the same issue as with not being able to use @AppStorage inside @observable (workaround for @AppStorage was suggested here https://medium.com/@davidsteppenbeck/accessing-userdefaults-within-observable-classes-in-ios-17-8cb46ca75689)
The text was updated successfully, but these errors were encountered: