struct List: View {
var stringArray = ["Mary", "Joe", "James", "Mark", "Beth", "Chase", "Adam", "Rodrigo", "Notice the automatic wrapping when the text is longer", "Mary", "Joe", "James", "Mark", "Beth", "Chase", "Adam", "Rodrigo", "Notice the automatic wrapping when the text is longer"]
var body: some View {
ZStack {
Color.blue.ignoresSafeArea()
List {
Section(header: Text("Section 1"), footer: Text("This is the footer")) {
ForEach(stringArray, id: \.self) { stringItem in
HStack {
Image(systemName: "person")
Text(stringItem)
}
.padding(.vertical)
.listRowBackground(Color.gray)
}
}
}
// .listStyle(PlainListStyle())
}
}
}
default
.listStyle(PlainListStyle())