如何在 SwiftUI 中删除表单的左右填充?我创建的每个视图在前导和尾随都有填充。
这是我的代码
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
}
}
}
}