I've used a NavigationView
which uses NavigationLink
to switch to a page which has TabView
. However there is an excess padding on the top of the TabView
pages, which is due to the NavigationBar.
Here's the code snippet which uses NavigationView
:
var body: some View {
NavigationView {
HomeView()
}
}
var body: some View {
@State var loggedIn: Bool = false
var body: some View {
VStack {
NavigationLink(destination: TabbedView(), isActive: $loggedIn){
EmptyView()
}
Button(action:{
self.loggedIn.toggle()
})
{
Text("Login")
}
}
}
}
var body: some View {
TabView {
Home()
.tabItem {
Image(systemName: "music.note")
.foregroundColor(.white)
Text("HOME")
.foregroundColor(.white)
}
Info()
.tabItem{
Image(systemName: "ellipsis.circle.fill")
.foregroundColor(.white)
Text("INFO")
.foregroundColor(.white)
}
}
.accentColor(.red)
}