1

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.

Maric Vikike
  • 237
  • 2
  • 8

1 Answers1

2

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)
    }
}
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87