Adding New Items
Append rows and keep the list in sync.
Growing the List
A useful list does not stay frozen. Letting users add items is the other half of editing, and it keeps your @State array in charge. ✨
Append to Your Array
Adding a row is just adding data. Call append on your @State array and SwiftUI inserts a fresh row automatically.
items.append(Item(name: "Bread"))All lessons in this course
- Swipe-to-Delete Rows
- Reordering with onMove
- Adding New Items
- Pull-to-Refresh