I'm making an App in which user needs to Log In and after that take me to a TabView in which I have 3 different views (Navigation Views).
The problem is after I Log In, and use a NavigationLink to send me to the TabView, to display me the 3 different views, in which I have NavigationBarTitles; it also creates another (empty) NavigationBarTitle over mine.
Already tried to use the usual method of: Inside this individual views, eliminate the NavigationView property, as it would usually work, but not in this case.
LOGIN VIEW
import SwiftUI
struct LogInView: View {
var body: some View {
NavigationView {
VStack {
NavigationLink (destination: ContentView()) {
Text("Log In")
.foregroundColor(.white)
.padding(15)
.background(Color.blue)
.cornerRadius(10)
}
}.navigationBarTitle("Log In View")
}
}
}
struct LogInView_Previews: PreviewProvider {
static var previews: some View {
LogInView()
}
}
TABVIEW
import SwiftUI
struct ContentView: View {
@State private var selection = 0
var body: some View {
TabView(selection: $selection){
DetailView()
.font(.title)
.tabItem {
VStack {
Image("first")
Text("First")
}
}
.tag(0)
}.edgesIgnoringSafeArea(.top)
.navigationBarBackButtonHidden(true)
.navigationBarHidden(true)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
DETAIL VIEW
import SwiftUI
struct DetailView: View {
var body: some View {
NavigationView {
List {
Text("Hi")
Text("Hi")
Text("Hi")
}.navigationBarTitle("DetailView")
}
}
}
struct DetailView_Previews: PreviewProvider {
static var previews: some View {
DetailView()
}
}