79584316

Date: 2025-04-21 09:09:21
Score: 0.5
Natty:
Report link

The simplest way is using listRowInsets(_:) to make zero insets for your item:

VStack {
   // ...
}
.listRowInsets(EdgeInsets())

I was able to achieve this behavior:

Edge to edge content

Using this code:

        List {
            // First item with custom insets
            VStack {
                Text("Edge to Edge Content")
                    .frame(maxWidth: .infinity, alignment: .leading)
                    .background(Color.gray.opacity(0.2))
            }
            .listRowInsets(EdgeInsets())
            .listRowSeparator(.hidden)

            // Standard list items
            ForEach(1..<10) { i in
                Text("Item \(i)")
            }
        }
        .listStyle(.plain)
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Kiryl Famin