struct cellModel:Identifiable {
var id = UUID()
var name:String
var desc:String
}
struct cell: View {
var model:cellModel
var body: some View {
VStack (alignment: .leading) {
Text(model.name)
.fontWeight(.bold)
.padding(10)
Text(model.desc)
}
}
}
struct ContentView: View {
var cells = [cellModel(name: "1", desc: "111"),
cellModel(name: "2", desc: "22222222222222"),
cellModel(name: "3", desc: "33333333"),
cellModel(name: "4", desc: "4444")
]
var body: some View {
List(cells) { item in
cell(model: item)
}
}
}
