Clear background for form sections in SwiftUI?

Even in SwiftUI 2 Form is built on top of UIKit, specifically UITableView.

You need to remove the default UITableViewCell‘s background (only once, preferably in the App init):

UITableViewCell.appearance().backgroundColor = UIColor.clear

and change the background using:

Section {
    VStack {
        Button("Button 1") {}
        Spacer()
        Button("Button 2") {}
    }
}
.listRowBackground(Color.clear)

Leave a Comment