Apologies if this has been asked/answered; I am trying to present a NavigationLink inside of a form, but would like it to be centered. I can do this with a Button using HStack and Spacers; the NavigationLink is a tat more stubborn:
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
Form {
HStack {
//BUTTON CENTERS WITH SPACERS
Spacer()
Button(action: {}, label: {
Text("Button")
})
Spacer()
}
HStack {
//NAVIGATIONLINK IGNORES SPACERS
Spacer()
NavigationLink(
destination: Text("Destination"),
label: {
Text("Navigate")
})
Spacer()
}
}
}
}
}