Last active
September 4, 2020 09:46
-
-
Save aataraxiaa/80bfdbb973b555365b392eada80c0622 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ContentView { | |
private var mainView: some View { | |
VStack { | |
Spacer() | |
Button(action: { | |
needsAppOnboarding = true | |
}) { | |
Text("Reset Onboarding") | |
.padding(.horizontal, 40) | |
.padding(.vertical, 15) | |
.font(Font.title2.bold().lowercaseSmallCaps()) | |
} | |
.background(Color.black) | |
.foregroundColor(.white) | |
.cornerRadius(40) | |
// #1 | |
.sheet(isPresented:$needsAppOnboarding) { | |
// Scenario #1: User has NOT completed app onboarding | |
OnboardingView() | |
} | |
// #2 | |
.onChange(of: needsAppOnboarding) { needsAppOnboarding in | |
if !needsAppOnboarding { | |
// Scenario #2: User has completed app onboarding during current app launch | |
appSetupState = "App setup 😀" | |
} | |
} | |
Spacer() | |
Text(appSetupState) | |
Spacer() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment