SwiftUI NavigationView navigationBarTitle LayoutConstraints issue

It had nothing to do with NavigationBarTitle. .navigationTitle is not deprecated. Seems the whole issue is mainly with the new Xcode 12.4 update, even for simple code:

var body: some View {
    NavigationView{
        Text("Hopefully will work this time")
            .navigationTitle("Error with constains")
    }
}

adding .navigationViewStyle(StackNavigationViewStyle()) fixes problem

var body: some View {
    NavigationView{
        Text("Yes it does!")
            .navigationTitle("Wow it works")
    }
    .navigationViewStyle(StackNavigationViewStyle())
}

Leave a Comment