How to set a background image for whole view (List) not rows

My listView is simple


struct ListView: View {
     var body: some View {
          NavigationView {
               List(myList) { element in 
                    NavigationLink(destination: NextView()) {
                         Text(element.name)
                   }     
               }
          }    
     }
}


Thought I could set a background Image for the whole View with

.background(Image("ImageName"))

modifier. But the lists background is still white.

I don't want to set an image for each row only once for the whole view.


Can anyone help?

I was able to get this to work by altering the UITableView and UITableViewCell themselves.

Here is the code:
Code Block Swift
struct ListView: View {
  var body: some View {
    NavigationView {
      List {
        Text("Hello!")
      }
      .onAppear() {
        UITableViewCell.appearance().backgroundColor = UIColor.clear
         
        let imageView = UIImageView(image: UIImage(named: "Dogs.jpeg"))
        imageView.contentMode = .top
        UITableView.appearance().backgroundView = imageView
      }
    }
  }
}

The imageView.contentMode can be changed to a variety of other choices that best fit your needs, see here. .top will place the image at the top of the list, without stretching it.
Try setting the List row backgrounds to a clear color:
Code Block
.listRowBackground(Color.clear)

How to set a background image for whole view (List) not rows
 
 
Q