Created
November 26, 2019 13:38
-
-
Save SatoTakeshiX/cc8c96c5f0834dc4623aec4f99cbbe14 to your computer and use it in GitHub Desktop.
TabbarとNavigationの組み合わせ、SwiftUIでうまくいかないぞ。。 #CodePiece #SwiftUI
This file contains 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 ContentView: View { | |
var body: some View { | |
TabView { | |
NavigationView { | |
NavigationLink(destination: Text("Next Page")) { | |
BlueView() | |
} | |
} | |
.navigationBarTitle(Text("Landmarks")) | |
.tabItem { | |
Image(systemName: "tv.fill") | |
Text("Second Tab") | |
} | |
RedView() | |
.tabItem { | |
Image(systemName: "phone.fill") | |
Text("First Tab") | |
} | |
} | |
} | |
} | |
struct RedView: View { | |
var body: some View { | |
Color.red | |
} | |
} | |
struct BlueView: View { | |
var body: some View { | |
Color.blue | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment