We can save the small piece of data when the app is closed.
@AppStorage("KEY") var Name: Type = Value
struct ContentView: View {
@AppStorage("onboarding") var isOnboarindViewActive: Bool = true
var body: some View {
ZStack {
if isOnboarindViewActive {
OnboardingView()
}
else {
HomeView()
}
}
}
}
struct OnboardingView: View {
//MARK: - PROPERTIES
@AppStorage("onboarding") var isOnboardingViewActive : Bool = true
...
struct HomeView: View {
//MARK: - PROPERTIES
@AppStorage("onboarding") var isOnboardingViewActive : Bool = false
...
Once we close the app on HomeView, we will never see the OnboardingView again.
Important: @AppStorage writes your data to UserDefaults, which is not secure storage. As a result, you should not save any personal data using @AppStorage, because it’s relatively easy to extract.
I am always intrigued by the idea of transforming a flat digital screen into an interactive extended screen. After experimenting with the Meta Quest platform using Unity, I found that ecosystem continuity was a significant challenge. I believe that with Apple's ecosystem, Vision Pro can refine and establish the concept of spatial computing apps. Despite lacking a computer science background, I am eager to embrace this challenge and enhance people's interactive experiences with the world.