Recap - Score Keeper
Part of the Introduction to SwiftUI section of Coddy's Swift journey. Lesson 23 of 50.
Challenge
MediumBuild a score keeper with a score state that starts at 0:
- a text with the identifier
scorethat readsScore: 0,Score: 1, ... - a
+1button that adds one - a
Resetbutton that sets the score back to0 - a text
New record!with the identifierrecordthat is only shown while the score is3or more
Try it yourself
import SwiftUI
@main
struct CoddyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}All lessons in Introduction to SwiftUI
Practice on your own: Swift playground