How to remove the left and right Padding of a Form in SwiftUI? Every View I create has padding in the leading and trailing.
Here is my code
init() {
UITableView.appearance().tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: Double.leastNonzeroMagnitude))
}
var body: some View {
NavigationView{
Form{
Section{
Picker(selection: $selectedCurrency, label: Text("Date Format"), content: {
ForEach(0 ..< self.dateStyles.count) { (index:Int) in
Text("\(self.dateStyles[index])")
}
})
}
}.listStyle(PlainListStyle())
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
.navigationBarTitle(Text("Settings"), displayMode: .inline)
.onAppear(){
if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] != "1"{
//some code
}
}
}
}
Using something else is probably best but this removes the padding.