struct ListView: View {
var body: some View {
List {
ListRowView(title: "This is the first title!")
}
}
}
struct ListRowView: View {
let title: String
var body: some View {
HStack {
Image(systemName: "checkmark.circle")
Text(title)
Spacer
}
}
}
struct ListView: View {
@State var items: [String] = [
"This is the first titel!",
"This is the second titel!",
"This is the third titel!"
]
var body: some View {
List {
ForEach(items, id: \.self) { item in
ListRowView(title: item)
}
}
}
}
import Foundation
struct ItemModel: Identifiable {
let id: String = UUID().uuidString
let title: String
let isCompleted: Bool
}
@State var items: [ItemModel] = [
ItemModel(title: ",,,", isCompleted: false)
ItemModel(title: ",,,", isCompleted: false)
ItemModel(title: ",,,", isCompleted: false)
]