Member-only story
Naked Networking with SwiftUI, gamification III
Ok, our game is getting along nicely and here is photo to prove it.
If you just stumbled across this article, than you need to read these ones first to get here.
Naked Networking with SwiftUI
More Naked Networking, more SwiftUI
Naked Networking and SwiftUI, the game plan
Naked Networking and SwiftUI, gamification
Naked Networking and SwiftUI, gamification II
What we need to do now is keep track of the score. We could do two simple labels, with a games won, games lost titles, but wouldn’t it be better to have a more visual indicator. Let’s put in row o’s or x’s to indicate how many games you played, how many you won and how many lost. We’ll do 7 games per round.
Once the round is over we need a means to reset things so we can start all over. But ok, getting ahead of myself.
SwiftUI
The main changes are in the ContentView.swift. We need an horizontal StackView and a list of indicators to say if we won [an o] or we lose [an x].
@State var game = 1
@State var game1 = ""
@State var game2 = ""
@State var game3 = ""
@State var game4 = ""
@State var game5 = ""
@State var game6 = ""
@State var game7 = ""