You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
951 B
43 lines
951 B
//
|
|
// 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()
|
|
}
|
|
}
|
|
|