Another benefit of nesting a ForEach inside a List is the ability to add static elements to the list. Say for example you want to show a button above the list. You could do it like this:
struct SwiftUIView: View {
var items = ["item01", "item02", "item03"]
var body: some View {
List {
Button("Add new item") {
print("Adding new item")
}
ForEach(items, id: \.self) { item in
Text(item)
}
}
}
}