Recap - Shopping List
Part of the Introduction to SwiftUI section of Coddy's Swift journey. Lesson 33 of 50.
Challenge
MediumBuild a shopping list in a VStack:
- a
TextFieldwith the placeholderItemand the identifierfield - an
Addbutton that appends the typed text to anitemsstate array (starting empty) and clears the field, and is disabled while the field is empty - a text with the identifier
countthat reads0 items,1 items,2 items, ... - a
Listof the items with the identifierlist
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