Background color for List in SwiftUI

Hi all, with the below code I get

How can I hide the gray angles?

Thank you for your help.


        NavigationView {
            ZStack {
                RoundedRectangle(cornerRadius: 10)
                    .foregroundColor(Color(red: 0.283, green: 0.481, blue: 0.658))
                    .shadow(radius: 10)
                    .overlay(
                        RoundedRectangle(cornerRadius: 15)
                            .stroke(Color(hue: 0.579, saturation: 0.0, brightness: 0.9), lineWidth: 2)
                    )
                List (
                    driversArr,
                    id:\.self,
                    selection: $selection) {
                        currentDriver in
                        NavigationLink {
                            RiskDriverDetailsView(theDriver: currentDriver)
                        } label: {
                            Label(currentDriver.wrappedName, systemImage: "point.filled.topleft.down.curvedto.point.bottomright.up")
                        }
                        .foregroundColor(.white)
                    }
                    .scrollContentBackground(.hidden)
            }
            .background(Color(.clear))
        }
Answered by pashlya in 765319022

You can just add .clipShape(RoundedRectangle(cornerRadius: 15)) over the ZStack to clip it.

Accepted Answer

You can just add .clipShape(RoundedRectangle(cornerRadius: 15)) over the ZStack to clip it.

Background color for List in SwiftUI
 
 
Q