Hi, When I use 'listSectionSeparator' on hide the section separator on a List 'section', it works as expected on iOS, but doesn't have any effect on macOS. Is that a known issue? Are there any workarounds for this?
Here's a basic reproducible example:
import SwiftUI
struct TestItem: Identifiable, Hashable {
let id = UUID()
let itemValue: Int
var itemString: String {
get {
return "test \(itemValue)"
}
}
}
struct TestListSelection: View {
let testArray = [TestItem(itemValue: 1), TestItem(itemValue: 2), TestItem(itemValue: 3), TestItem(itemValue: 4)]
@State private var selectedItem: TestItem? = nil
var body: some View {
List (selection: $selectedItem) {
Section("Header") {
ForEach (testArray, id: \.self) { item in
Button {
print("main row tapped for \(item.itemValue)")
} label: {
HStack {
Text(item.itemString)
Spacer()
Button("Tap me") {
print("button tapped")
}
.buttonStyle(.borderless)
}
}
.buttonStyle(.plain)
}
}
.listSectionSeparator(.hidden) // has no effect on macOS
Section("2nd Header") {
ForEach (testArray, id: \.self) { item in
Text(item.itemString)
}
}
.listSectionSeparator(.hidden) // has no effect on macOS
}
.listStyle(.plain)
}
}
#Preview {
TestListSelection()
}