[SOLVED] SwiftUI : How to get a Navigation Title aligned with Back Button


This Content is from Stack Overflow. Question asked by narner

I’m trying to get the navigation title vertically aligned with the back button in a NavigationDetail view in SwiftUI. Here’s what this looks like currently:

enter image description here

Below’s my code for adding the Navigation Bar title to the view. How do I get it vertically aligned with the Back button?

 var body: some View {
        Text("My Detail View")

        VStack {
            List {
                ForEach(0..<layerSettings.count, id: .self) { each in


If you need to draw "My Detail View" on the same line that the Back button, try to do like this:

 NavigationView {
    VStack() {
    .navigationBarTitle(Text("My Detail View"),
                        displayMode: .inline)

This Question was asked in StackOverflow by narner and Answered by stosha It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?