benpomeroy9
benpomeroy9

Reputation: 417

How can I add picture to side of iPad Navigation View in SwiftUI?

I have a TabBar view which has a navigation view as one of the tabs. On iPad the view hugs the left and I want a picture/logo on the right hand side next to it (as shown in the picture). How would I add this in?

enter image description here

Here is my navigation view code:

struct StartGameScreen: View {
    
    @ObservedObject var processor = EventsProcessor.shared
    
    @State var showGame = false
    
    var body: some View {
        NavigationView{
            Form{
                Section(header: Text("Teams")){
                    TextField("Home Team Name", text: $homeName)
                    TextField("Away Team Name", text: $awayName)
                }
                Section(header: Text("The Fixture")){
                    TextField("Location", text: $location)
                    DatePicker("Date of Fixture", selection: $date, displayedComponents: .date)
                }
                Section(header: Text("Officials")){
                    TextField("Referee", text: $referee)
                    TextField("Assistant Referee 1", text: $ar1)
                    TextField("Assistant Referee 1", text: $ar2)
                    TextField("4th Official", text: $fourthOfficial)
                    TextField("Televsion Match Official", text: $tmo)
                    
                }
                
                Button("Start Game"){
           
                    self.showGame.toggle()
                    
                }
                .fullScreenCover(isPresented: $showGame, content: {
                    ContentView()
                })
                
            }
            .navigationBarTitle("New Game")
            
        }
        
    }
}

Upvotes: 1

Views: 50

Answers (1)

Asperi
Asperi

Reputation: 257693

You can add it

var body: some View {
    NavigationView{
        Form{
           // ... other code                
        }
        .navigationBarTitle("New Game")
        
        Image("logo")          // << here !!
    }
}

Upvotes: 2

Related Questions