I have been trying this for a while but with everything I do, I don't get the desired result. To be clear, I don't want to use the inline display mode, I want a large title but centered.
Here is what I'm trying to do:
My best attempt was a toolbar like this
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
Text("Title")
.font(.manrope(.bold(), size: 30)
.accessibilityAddTraits(.isHeader)
.padding(.top, 75)
}
}
While this worked fine on the first page when you navigate and/or return to a page, the heading disappears.
Ideally, I'd like to center the Title using an initializer as I did for the font:
init() {
UINavigationBar.appearance().largeTitleTextAttributes = [.font : UIFont(name: "Manrope-Bold", size: 30)!]
}