Currently, you have four Text views that represent arrows for the player direction. Turn these Text() views into buttons.
Exercise 2: Increase the Size of the Arrows
The arrows are pretty small. It would be nice to increase the size of them. Add the following modifier to each arrow.
.font(.system(size: 50.0))
Exercise 3: Add State Variables
In this app, the bunny will traverse the maze. You will track the position of the rabbit by the rabbit’s current column and current row. You’ll be using arrays so the first row or first column is the zero index. The current location is (0, 8).
It will be nice to have the player’s location printed out on the screen. Add a new text and add the player’s location to it.
Exercise 5: Alter the Player Coordinates
Each time the user taps one of the arrow keys, the player’s coordinates should update on the screen. Don’t worry about the numbers going negative. This is just for display purposes.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.