I am not gonna lie, but the modifiers in SwiftUI are super tricky. I want to get rid of the grey area above my list. I have tried all, padding, offset, frame, you name it. It's still there. Why is it there anyway. Is it some kind a header that I could possibly undefine? Anyway, here is the code:
List{
ForEach(prim, id: \.id) { value in
GeometryReader { geometry in
HStack {
Text(value.label)
.font(.system(size: 12))
.padding(.vertical, 0)
.frame(width: geometry.size.width/4)
Spacer(minLength: geometry.size.width/4)
TextField("", value: value.data , formatter: NumberFormatter())
.font(.system(size: 12))
.padding(.vertical, 0)
.keyboardType(.numberPad)
.textFieldStyle(RoundedBorderTextFieldStyle())
}.padding(.top, 0)
}.padding(.top, 0)
}.padding(.top, 0)
}
.padding(.top, 0)
.listStyle(GroupedListStyle())
I have not defined the grey area, so why is it there? It pushes my list down and so my third item in the list disappears.
If it is not empty NavigationView (because it is not clear where is this List placed), then it is due to used list style.
You can use instead plain style
}
.padding(.top, 0)
.listStyle(PlainListStyle())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With