I have a form with 2 buttons. Now I would like to have a little space between these two buttons. Exactly like in this example:
Does anyone know how to implement this? I appreciate any help!
Try with my below code to achieve your exact output.
In the init method TableView sectionHeaderHeight is set to .zero
init
sectionHeaderHeight
.zero
I have added one button to the section and added an empty title to set dummy space.
struct ContentView: View { init() { UITableView.appearance().sectionHeaderHeight = .zero } var body: some View { Form { Section { HStack { Text("Zeit:") .fontWeight(.semibold) Spacer() Text("Zeit:") .fontWeight(.semibold) } DatePicker(selection: .constant(Date())) { Text("Erstellt:") .fontWeight(.semibold) } } Section(header: Text("")) { Button { } label: { HStack { Spacer() Text("Teilen") Spacer() } } } Button { } label: { HStack { Spacer() Text("Löschen") Spacer() } } .tint(.red) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Output:
Replace the above code and try with that...!
Copyright © 2021 Jogjafile Inc.
Try with my below code to achieve your exact output.
In the
initmethod TableViewsectionHeaderHeightis set to.zeroI have added one button to the section and added an empty title to set dummy space.
Replace the above code and try with that...!