MasterOnce
HomeBlogHow-To
3 min readMar 13, 2026
Swift

How to Build a List in SwiftUI

Render a list from an array.

Steps

  1. Paste the view into a SwiftUI file.
  2. Set it as a preview or root view.
  3. Update state or bindings to match your data.

Copy and paste

import SwiftUI

struct ListView: View {
    let items = ["One", "Two", "Three"]

    var body: some View {
        List(items, id: .self) { item in
            Text(item)
        }
    }
}

Notes

  • Use @State for local values and bindings for child views.
  • Extract subviews when the body grows.