Maric Vikike
Maric Vikike

Reputation: 247

How to round corner and decrease the size of a List in SwiftUI?

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.

Upvotes: 1

Views: 1152

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100543

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)
    }
}

Upvotes: 2

Related Questions