I created an entry form as an independent project with the navigation bar working great. I then copied the view to my overall project. In the process my inline navigation bar title split up leaving the Back button where it should be and creating a large space before displaying the title and the Save button (See photo below). There is a similar question at How to remove the default Navigation Bar space in SwiftUI NavigiationView but they are trying to remove the space in addition to the title from a List whereas I'm working with a form. Another question with large navigation bar space was due to a duplicate navigation bar title (Removing large amounts of whitespace in a SwiftUI subview). That is not the case here. Any ideas?
here is some of the code:
`struct entryView: View {
@EnvironmentObject var userData: UserData
@Environment(\.managedObjectContext) var viewContext // core data
. . .
var body: some View {
NavigationView {
Form {
// get entry date and time
Section {
HStack {
Image("iconCalendar24")
Spacer()
DatePicker("", selection: $entryDT, in: ...Date())
.datePickerStyle(CompactDatePickerStyle())
}
}
. . .
// select entry category
Section {
HStack {
Text("Select Category")
.font(Font.subheadline.bold())
Picker(selection: $entryCat, label: Text("")) {
ForEach(0 ..< self.categories.count) {
Text(self.categories[$0]).tag($0)
}
}
}
}
.navigationBarTitle(Text("Expense Entry"), displayMode: .inline)
.navigationBarItems(trailing:
Button(action: {
self.saveButton() // button pressed
}) {
Text ("Save")
}.disabled(moneyS.isEmpty)
)
}
}
}
}