I'm not able to change the background color of a Form in SwiftUI for iOS < 16. It always takes default form backgroundcolor depending on which color scheme is selected in the iPhone settings. All solution I found here to set the UITableView.appearance().backgroundColor = .clear also don't work. Do any of you have a solution?
I tried different solutions:
UITableView.appearance().backgroundColor = .clear
-
GeometryReader { geometry in ZStack { Rectangle().foregroundColor(.white).frame(width: geometry.size.width, height: geometry.size.height) Form { // your form content here } } } -
struct FormBackgroundColorModifier: ViewModifier { var color: Color func body(content: Content) -> some View { ZStack { color.edgesIgnoringSafeArea(.all) content } } } struct MyForm: View { var body: some View { Form { } .modifier(FormBackgroundColorModifier(color: .white)) } }
Just use
.scrollContentBackground(.hidden)