Reputation: 1108
I'm trying to move a navigation title to right side instead of left, any idea on how to implement that?
init() {
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor.white]
}
var body: some View {
NavigationView {
Color.init("midnight blue")
.edgesIgnoringSafeArea(.vertical)
.navigationBarTitle("המרות מטבע")
.navigationBarItems(trailing:
Button(action: {
print("button pressed")
}) {
Image(systemName: "plus")
.foregroundColor(Color.orange)
})
}
}
Upvotes: 0
Views: 1849
Reputation: 261
you can use navigationBarItem where in you can customise your text. for me this code is working :
.navigationBarItems(trailing: Text("Title on Right"))
.navigationBarTitle(Text(""), displayMode: .inline)
Upvotes: 2
Reputation: 5320
I assume this is what you are looking for. But consider this is applied by iOS automatically dependend on your language settings.
NavigationView {
Color.init("midnight blue")
.edgesIgnoringSafeArea(.vertical)
.navigationBarTitle("המרות מטבע")
.navigationBarItems(trailing:
Button(action: {
print("button pressed")
}) {
Image(systemName: "plus")
.foregroundColor(Color.orange)
})
}.environment(\.layoutDirection, .rightToLeft)
Upvotes: 4