How do I get buttons and a title on the right side?

I’m new to Swift, and I’m currently developing an application. When I run the code I get a tab on the left of the screen with a title and a list. This tab can be closed. On the right side of this tab there is a blank space. I was wondering how I could add a title and buttons in that space?

The code I’m using:

`import SwiftUI

struct ContentView: View {

    var body: some View {

        NavigationView {

            List {

                Text("Text")

                

                }

            .navigationTitle("Text")

            

            }

        

        }

        }

All you describe in not in the code you post, so it is a bit difficult to be sure.

You should post a capture of what you get and a drawing of what you want

But in principle, replace

        Text("Text")

by

HStack {
        Text("Text")
         Text("title")
         Button()  // Create the button here
}

As you are new here, note that your tag must be selected properly. Here it is not Swift but SwiftUI.

Also, when you paste code, use Paste and Match Style to avoid all blank lines, and use code formatter. You will get this presentation:

import SwiftUI
struct ContentView: View {
    var body: some View {
        NavigationView {
            List {
                HStack {
                    Text("Text")
                    Text("title")
                    Button("Hello", action: { print("OK")}) // Create the button here
                }
            }
            .navigationTitle("Text")
        }
        
    }
}

How do I get buttons and a title on the right side?
 
 
Q