Open LeoNatan opened 7 months ago
Are you sure?
.onChange()
works just as expected for me.
@Observable
class SettingsManager {
static let shared = SettingsManager()
@ObservableUserDefault(.init(key: "TOGGLE_TEST", defaultValue: false, store: .standard))
@ObservationIgnored
var testToggle: Bool
}
struct DarkModeToggleView: View {
@State var settingsManager: SettingsManager = .shared
var body: some View {
Toggle("Test Toggle", isOn: $settingsManager.testToggle)
.onChange(of: settingsManager.testToggle) { oldValue, newValue in
print("observability: \(oldValue) - \(newValue)") // <- HERE
}
}
}
Hello,
This library misses a major functionality of “observability”, which is notifying of changes that occur to the observed value from different processes.
Cheers