How to remove the line separators from a List in SwiftUI without using ForEach?

前端 未结 13 1725
盖世英雄少女心
盖世英雄少女心 2021-01-30 04:50

I have this code to display a list of custom rows.

struct ContentView : View {
    var body: some View {
        VStack(alignment: .leading) {
            List(1         


        
13条回答
  •  隐瞒了意图╮
    2021-01-30 05:37

    Use a ScrollView?

    Some state that represents your list

    @State var menuItems: [String] = ["One", "Two", "Three"]
    

    The a SwiftUI ForEach loop inside a ScrollView

    ScrollView {
        ForEach(self.menuItems, id: \.self) { item in
            Text(item)
        }
    }
    

提交回复
热议问题