display simple view with two text fields inside a vStack/HStack combination. It leaves huge gap at the top as shown on the attached image. I tried vStack, it has .leading and .trailing which justifies left or right. How can set specific spacing at the top? code:
@Environment(\.managedObjectContext) private var viewContext
@Environment(\.dismiss) var dismiss
@Environment(\.presentationMode) var presentationMode
@Binding var chosenPlan: ProviderApiCaller.ProviderData
@State var state: String?
@State var zip: String?
func onAdd(plan: ProviderApiCaller.ProviderData ) {
}
var body: some View {
NavigationView {
VStack {
HStack {
Text(chosenPlan.name!)
}
HStack {
Text(chosenPlan.plans.first!.planUrl)
}
}
}
.navigationTitle("Plan Details")
.toolbar {
// Back button
ToolbarItem(placement: .navigationBarLeading) {
Button(action: { presentationMode.wrappedValue.dismiss() }, label: {
HStack(spacing: 2) {
Image(systemName: "chevron.backward")
.foregroundColor(.black)
Button("Back", action: {
self.presentationMode.wrappedValue.dismiss()
} )
.foregroundColor(.black)
}
})
}
ToolbarItem(placement: .confirmationAction) {
// Button("Save", action: { Task { try? await rI?(nameInput, phoneInput) } })
Button("Save", action: { onAdd(plan: chosenPlan)
} )
.foregroundColor(.blue)
}
}
.navigationViewStyle(StackNavigationViewStyle())
.navigationBarBackButtonHidden(true)
}
![]("https://developer.apple.com/forums/content/attachment/7510538e-c8b1-42d2-a68a-94d5aeaac186" "title=Screenshot 2023-05-26 at 4.11.30 PM.png;width=429;height=881")