How to change background of List view with image or color in SwiftUI?

Hi,


My requrement is to set background view as image to the List view in SwiftUI.

Could any one help me achive it?


Regards,

Ranjeet


struct TableView_SwiftUI: View {
    
    var body: some View {
        List(1...5) { row in
            Text("Row Index \(row)")
        }.background(Image("bg"))
    }
}

for background color

List(0..<10) { item in
      Text(" item \(item)")
}
.colorMultiply(.green)



for image

List(0..<10) { item in
      Text(" item \(item)")
}
.opacity(0.5)
.background(Image(.........))

colorMultiply is not the way to go as it tints the cells and background. But I don't think there is a solution to this if one just wants to replace the dull gray.

For now I used a VStack with ForEach to emulate a List but with more visual customization.

How to change background of List view with image or color in SwiftUI?
 
 
Q