import SwiftUI
struct ContentView: View {
var body: some View {
List {
Section(header: Text("Header")) {
Text("Hello")
Text("World")
}
Section(header: Text("Header")) {
ForEach(0..<3){
Text("HI \($0)")
}
}
Section(footer: Text("Footer")) {
Text("Hello")
Text("World")
}.foregroundColor(Color.gray)
}.listStyle(GroupedListStyle())
}
}
From: SwiftUI 知识碎片