I want to change the background white to an another color to the List in SwiftUI
List(listOfItems) { item in
Group {
HStack {
item.iconImage.padding()
Text(item.text).fontWeight(.regular).foregroundColor(Color("smalltext")).font(.system(size: 25))
Spacer()
Button(action: {
}) {
Image("back")
}
}.padding().background(Color("bg"))
}.listRowBackground(Color("bg"))
}.background(Color("bg"))
If you want to change the background color you would do the following in the view containing the List
. Add this init
block in your View
. This will change everything to green.
init() {
UITableViewCell.appearance().backgroundColor = .green
UITableView.appearance().backgroundColor = .green
}