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() |
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 FirstDetailView: View { | |
@EnvironmentObject var nav: NavigationController | |
var body: some View { | |
VStack { | |
Text("Whaterever") | |
Button(action: { | |
self.nav.detailIsShown = false | |
}) { |
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 FirstDetailView: View { | |
@EnvironmentObject var nav: NavigationController | |
var body: some View { | |
VStack { | |
Text("show me the details") | |
Button(action: { | |
self.nav.selection = 1 | |
}) { |
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 ContentView: View { | |
@EnvironmentObject var nav: NavigationController | |
var body: some View { | |
// binding TabView selection to NavigationController | |
TabView(selection: self.$nav.selection){ | |
FirstView() |
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 UIKit | |
import SwiftUI | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
//add the NavigationController like so: |
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
struct AlertExampleView: View { | |
@State var showAlert: Bool = false | |
var body: some View { | |
VStack { | |
Text("This is an example").font(.headline) | |
Button(action: { | |
self.showAlert = true | |
}) { | |
Text("show alert sheet") | |
} |
NewerOlder