Hi,
using the following ContentView
in a SwiftUI app on macOS I would expect that the state of the toggle persists across application launches:
struct ContentView: View {
@SceneStorage("Toggle") var onOrOff: Bool = false
var body: some View {
VStack {
Toggle("Will it persist?", isOn: $onOrOff)
.padding()
}
}
}
To my surprise it does not persist. Am I wrong about how @SceneStorage
should work? (I am trying this on the lates macOS/Xcode versions)
Does @SceneStorage
work for anybody on macOS?
Thanks for your feedback!
Cheers, Michael