Mobile development

Stage 2 · Lesson 7 of 10

List, ForEach and lazy grids

SwiftUI views and layout

List shows scrolling with the platform's standard look. Like other , it creates rows only as they appear. ForEach makes views from a collection, and each item needs a stable identity.

Either the item conforms to Identifiable with an id property, or you pass id: \.someProperty. Stable ids let animate items being added and removed, and keep the right state on each row. Use Section for grouped lists and .swipeActions for delete or archive.

For custom layouts, LazyVStack and LazyVGrid inside a ScrollView build items only when needed. AsyncImage loads remote images with a placeholder, but does little caching.

Common trapid: \.self on values that repeat, which confuses rows.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CourseFree
    SwiftUI Tutorials (Apple)

    Apple · Beginner

    Apple's own path from views and stacks to lists and navigation

  • CourseFree
    100 Days of SwiftUI

    Paul Hudson (Hacking with Swift) · Beginner

    Days 16 to 35 build six small apps on views, modifiers, lists and animation

Practise

  • Use a free challenge's mobile design image as the spec for a native screen

Keep handy

Mark this stage as not done?