Hi,
However I tried to reduce space between list rows in below code I fail, is there any way to reduce this space ?
@State var flag: Bool = false
var myList: [String] = ["Hello", "World", "SwiftUI"]
var body: some View {
VStack(alignment: .leading) {
List (myList, id: \.self) { list in
Text(list)
.border(Color.black)
.font(.system(size: 12)) // Smaller font size
.frame(maxWidth: .infinity, minHeight: 20, alignment: .leading) // Reduced height
.padding(.vertical, 4) // Minimal padding for vertical spacing
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) // Remove insets
.listRowSeparator(.hidden) // Hide separator
}
.listStyle(.plain)
}
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(sysSecondary.opacity(0.4), lineWidth: 1)
)
.frame(width: 220, height:260)
.background(.white)
.clipShape (RoundedRectangle (cornerRadius: 10))
}
}