Is there a way to make List style insetGrouped in SwiftUI?
In iOS 13.2, you can set .environment(\.horizontalSizeClass, .regular)
on .listStyle(GroupedListStyle())
to get the same style as UITableView.Style.insetGrouped
.
List {
Section {
Text(“Test Row Title 1”)
}
Section {
Text(“Test Row Title 2”)
}
}.listStyle(GroupedListStyle())
.environment(\.horizontalSizeClass, .regular)
https://sarunw.com/tips/inset-grouped-in-swiftui/
Apparently there is a new API in iOS/iPadOS 14 which finally allows InsetGrouped style to be in SwiftUI.
List {
...
}
.listStyle(InsetGroupedListStyle())