I'm trying to use the new property wrapper for iOS 14 "SceneStorage" though it is producing this error:
Fatal error: @SceneStorage is only for use with SwiftUI App Lifecycle.: file SwiftUI, line 0
Here is my code:
struct ContentView: View {
@SceneStorage("isLoggedIn") var isLoggedIn = true
var body: some View {
Text("Hello, World!).onAppear {
print($isLoggedIn)
}
}
}
Updated.... Thanks, @Asperi!. Make sure you set the Life Cycle to SwiftUI App.
