Hello, I've managed to get rid of these spaces in different ways. Using scrollview, giving negative insets, rewriting modifiers from scratch with plain style etc. But I couldn't solve this with a simple solution. I've read comments from many people experiencing similar problems online. It seems like there isn't a simple modifier to remove these spaces when we use sidebar as the list style in SwiftUI, or I couldn't find the simple solution.
I wonder what's the simplest and correct way to reset these spaces?
let numbers = Array(1...5)
@State private var selected: Int?
var body: some View {
List(numbers, id: \.self, selection: $selected) { number in
HStack {
Text("Test")
Spacer()
}
.frame(maxWidth: .infinity, alignment: .leading)
}
.listStyle(.sidebar)
}
}