I have a List
with Sections
:
List {
ForEach((1...3), id: \.self) { _ in
Section(
header: Text("My Section")
.font(.system(.title3))
.fontWeight(.bold)
.foregroundColor(.primary),
content: {
ForEach((1...5), id: \.self) { _ in
Text("My Row")
}
}
)
}
}
Here is the result on an iPhone 8 simulator with iOS 14.5:
And here the result on an iPhone 8 simulator with iOS 15:
I want iOS15 list to be equal to iOS14.5 one. I can remove horizontal padding by adding .listStyle(PlainListStyle())
to the List
but the header of the section still have different vertical padding.
Is there a way to have the same vertical header padding as iOS14.5 ?
Environment:
Change list's style to GroupedListStyle
using the .listStyle()
modifier.
.listStyle(GroupedListStyle())
Header without gray backgrounnd
.listStyle(PlainListStyle())