Skip to content

Instantly share code, notes, and snippets.

@SatoTakeshiX
Created November 26, 2019 13:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SatoTakeshiX/cc8c96c5f0834dc4623aec4f99cbbe14 to your computer and use it in GitHub Desktop.
Save SatoTakeshiX/cc8c96c5f0834dc4623aec4f99cbbe14 to your computer and use it in GitHub Desktop.
TabbarとNavigationの組み合わせ、SwiftUIでうまくいかないぞ。。 #CodePiece #SwiftUI
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