I have an existing app that has a custom background color for List views. I've used the following in older iOS versions to get this to work.
UITableView.appearance().backgroundColor = .clear
With iOS 16 the new way to color the background is with
List {
Text("Item 1")
Text("Item 2")
Text("Item 3")
}
.scrollContentBackground(Color.red)
However, my app's Deployment target is iOS 14. When I add the new code above I get an error stating this is only for iOS 16 and later.
The new Lists are now built on UICollectionView instead of UITableView so I tried
UICollectionView.appearance().backgroundColor = .clear
This didn't work. When I run iOS 16 in the simulator my custom background color does not show up. Any help here would be appreciated.