📜  列表标题 swiftui - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:58.744000             🧑  作者: Mango

代码示例1
struct MyHeader: View {
    var body: some View {
        Text("Header")
    }
}

struct DemoTableHeader: View {
    let myList: [String] = ["1", "2", "3"]

    var body: some View {
        List {
            MyHeader()
            ForEach(myList, id: \.self) { element in
                Text(element)
            }
        }
    }
}