How to remove the left and right Padding of a List in SwiftUI?

It looks like .listRowInsets doesn’t work for rows in a List that is initialised with content.

So this doesn’t work:

List(items) { item in
    ItemRow(item: item)
        .listRowInsets(EdgeInsets())
}

But this does:

List {
    ForEach(items) { item in
        ItemRow(item: item)
            .listRowInsets(EdgeInsets())
    }
}

Leave a Comment