1

I just want to set a Color as background color to my list. Can't find anything that work,

It looks like is not possible, I don't want to change every single color of my row.

Any tips how to do it? Looks like SwiftUI and List don't allow the background color, it allow only color per single raw.

struct ContentView: View {
    var body: some View {
        ZStack {
            RadialGradient(gradient: Gradient(colors: [.orange, .red]), center: .center, startRadius: 100, endRadius: 470).edgesIgnoringSafeArea(.all)
                .overlay(
                    List(0 ..< 5) { item in
                        Text("Test")
                    }
            )
        }
    }
}
0

1 Answer 1

3

You can add

init() {
    UITableView.appearance().backgroundColor = .clear
    UITableViewCell.appearance().backgroundColor = .clear 
}

to your struct and then set background for your list.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.