I’m working on a screen that uses a single SwiftUI List composed of:
- a top block (statistics, month picker, year selector, total, Entrata/Uscita picker).
- a list of transactions grouped by day, each group inside its own Section.
- each row is a fully custom card with rounded corners (RoundedCornerShape)
I’m correctly removing all separators using:
.listRowSeparator(.hidden)
.listSectionSeparator(.hidden)
.scrollContentBackground(.hidden)
.listStyle(.plain)
Each row is rendered like this:
TransazioneSwipeRowView(...)
.listRowInsets(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16))
.listRowBackground(Color.clear)
However, I still see thin horizontal lines appearing between:
- the search bar and the top block
- the top block and the start of the list
- between rows inside the grouped section
- sometimes at the bottom of a Section
These lines are NOT:
- Divider()
- system separators
- backgrounds
- row borders
They seem to be “ghost lines” automatically generated by SwiftUI’s List when multiple consecutive rows or sections are present.
Goals
I want to remove these horizontal “ghost lines” completely while keeping:
- native SwiftUI List
- native scroll behavior
- swipe-to-delete support
- grouping by Section
- custom card-like rows with rounded corners
What I already tried
- .plain, .grouped, .insetGrouped list styles
- .listRowSeparator(.hidden) and .listSectionSeparator(.hidden)
- .scrollContentBackground(.hidden)
- clearing all list and row backgrounds
- adjusting/removing all padding and insets
- Spacer(minLength: 0) tests
- rebuilding the layout using ScrollView + LazyVStack (this works perfectly — no lines — but loses native swipe-to-delete)
There are no Divider() calls, and no background colors that could generate borders. The lines seem to be drawn by SwiftUI internally.
Question
Is this a built-in behavior of SwiftUI’s List in .plain style when using multiple custom rows? Or is there an officially supported way to eliminate these lines entirely?
More specifically, is there a recommended combination of modifiers to achieve:
- a List with grouped Sections
- fully custom rows with rounded corners
- no horizontal separators at all, even in the empty gaps between sections?
Any guidance, documented workarounds, WWDC references, or official recommendations would be greatly appreciated.
