// // ContentView.swift // NavigationExemple // // Created by Arthur Dambrine on 02/04/2021. // import SwiftUI struct ContentView: View { @State private var score = 0 var body: some View { NavigationView{ Text("Score: \(score)") .navigationTitle("Menu principal") .navigationBarItems( trailing: HStack{ Button("Add"){ self.score += 1 } Button("Sub"){ self.score -= 1 } } ) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }