Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct ContentView : View {
- @State var counter:Int = 0;
- var body: some View {
- VStack {
- HStack {
- Text("You counter value: ")
- .padding(5)
- Text(String(counter))
- .font(.largeTitle)
- .color(.red)
- }.padding(20)
- HStack {
- Button(action: {
- self.counter -= 1
- },
- label: {
- Text("Decrease(-)")
- })
- Spacer()
- Button(action: {
- self.counter += 1
- },
- label: {
- Text("Increase(+)")
- })
- }
- }
- .padding(20)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement