Last active
June 21, 2020 10:11
-
-
Save gahntpo/80875b7729d866da77c7249fe25e19d2 to your computer and use it in GitHub Desktop.
Show onboarding during first launch
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
import SwiftUI | |
struct MainView: View { | |
@EnvironmentObject var nav: NavigationController | |
var body: some View { | |
ZStack { | |
if nav.hasSeenOnboarding { | |
MainContentView() | |
}else { | |
OnboardingView() | |
} | |
} | |
} | |
} | |
struct OnboardingView: View { | |
@EnvironmentObject var nav: NavigationController | |
var body: some View { | |
VStack(spacing: 20) { | |
Text("Onboarding").font(.title) | |
Text("Show all the information") | |
Button(action: { | |
self.nav.hasSeenOnboarding = true | |
}) { | |
Text("done") | |
} | |
} | |
} | |
} | |
struct MainContentView: View { | |
var body: some View { | |
Text("Main content view") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment