Menu
Coddy logo textTech

Recap - Score Keeper

Part of the Introduction to SwiftUI section of Coddy's Swift journey. Lesson 23 of 50.

challenge icon

Challenge

Medium

Build a score keeper with a score state that starts at 0:

  • a text with the identifier score that reads Score: 0, Score: 1, ...
  • a +1 button that adds one
  • a Reset button that sets the score back to 0
  • a text New record! with the identifier record that is only shown while the score is 3 or 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