Categories
SwiftUI

SwiftUi Navigation Bar Back Button disappears after entering the third view

The .toolbar modifier on the NavigationView hides the Backbutton in a Buggy way!

Solution:

var body: some View {
        VStack (alignment: .leading) {
            ...
        }
        .toolbar {
            // to fix the back button disappeared
            ToolbarItem(placement: .navigationBarLeading) {
                Text("")
            }
            

            ToolbarItemGroup(placement: .navigationBarTrailing) {
                Button("About") {
                    print("About tapped!")
                }
                
                Button("Help") {
                    print("Help tapped!")
                }
            }
        }
    }

Hope this help.

Ref: https://stackoverflow.com/questions/64409091/swiftui-navigation-bar-button-disappears-after-entering-the-third-view-controll