Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import SwiftUI
  2.  
  3. struct ContentView : View {
  4.  
  5. @State var counter:Int = 0;
  6.  
  7. var body: some View {
  8. VStack {
  9. HStack {
  10. Text("You counter value: ")
  11. .padding(5)
  12. Text(String(counter))
  13. .font(.largeTitle)
  14. .color(.red)
  15. }.padding(20)
  16.  
  17. HStack {
  18. Button(action: {
  19. self.counter -= 1
  20. },
  21. label: {
  22. Text("Decrease(-)")
  23. })
  24. Spacer()
  25. Button(action: {
  26. self.counter += 1
  27. },
  28. label: {
  29. Text("Increase(+)")
  30. })
  31. }
  32. }
  33. .padding(20)
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement