0PricingLogin
SwiftUI Academy · Lesson

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

  1. Swipe-to-Delete Rows
  2. Reordering with onMove
  3. Adding New Items
  4. Pull-to-Refresh
← Back to SwiftUI Academy