Component - List view basics
This UI component shows a simple list of items vertically. Each item is a row that the user can scroll through. It helps display many pieces of information in a clean, organized way.
This UI component shows a simple list of items vertically. Each item is a row that the user can scroll through. It helps display many pieces of information in a clean, organized way.
NavigationView
└── List
├── Text ("Apple")
├── Text ("Banana")
├── Text ("Cherry")
└── Text ("Date")List view in SwiftUI primarily do?fruits?struct ContentView: View {
let numbers = [1, 2, 3]
var body: some View {
List(numbers, id: \.self) { num in
Text("Number: \(num * 2)")
}
}
}struct ContentView: View {
let items = ["A", "B", "C"]
var body: some View {
List(items) { item in
Text(item)
}
}
}Person conforming to Identifiable with a unique id. How do you create a List to display each person's name?Pass the test and this pattern moves unknown