Menu
Coddy logo textTech

Recap - Shopping List

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

challenge icon

Challenge

Medium

Build a shopping list in a VStack:

  • a TextField with the placeholder Item and the identifier field
  • an Add button that appends the typed text to an items state array (starting empty) and clears the field, and is disabled while the field is empty
  • a text with the identifier count that reads 0 items, 1 items, 2 items, ...
  • a List of the items with the identifier list

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