I would like to decrease the width of a List and also round its corner.
I have tried the .cornerRadius() and frame(width:) modifiers, but it did not work for me.
You can try
struct ContentView : View {
var body: some View {
List{
Text("Hello World").listRowBackground(Color.green)
Text("Hello World").listRowBackground(Color.green)
Text("Hello World").listRowBackground(Color.green)
Text("Hello World").listRowBackground(Color.green)
}.cornerRadius(30).frame(width: 200, height:200, alignment: .center)
}
}