Follow along at https://www.hackingwithswift.com/100/swiftui/22.
This day covers Part Three of Project 2: Guess The Flag
in the 100 Days of SwiftUI Challenge. (Project files can be found in the directory for Part One.)
In addition to recapping the material covered during the project's other days, Day 18 focuses on extending the project according to a set of challenges.
Add an
@State
property to store the user’s score, modify it when they get an answer right or wrong, then display it in the alert.
- (Already Covered 🙂)
Show the player’s current score in a label directly below the flags.
- 🔗 Commit
When someone chooses the wrong flag, tell them their mistake in your alert message – something like “Wrong! That’s the flag of France,” for example.
- 🔗 Commit