Added convenience method to set navigation bar title
This commit is contained in:
parent
87bf88153e
commit
a7fedc4f05
|
@ -6,7 +6,13 @@ extension View {
|
|||
func hideNavigationBar() -> some View {
|
||||
return self
|
||||
.navigationBarHidden(true)
|
||||
.navigationBarTitle("Title")
|
||||
.navigationBarTitle("", displayMode: .inline)
|
||||
}
|
||||
|
||||
func showNavigationBarTitle(_ title: LocalizedStringKey, displayMode: NavigationBarItem.TitleDisplayMode = .inline) -> some View {
|
||||
return self
|
||||
.navigationBarHidden(false)
|
||||
.navigationBarTitle(title, displayMode: displayMode)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ struct AccountTransactionsDialog: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.navigationBarTitle(Text(title), displayMode: NavigationBarItem.TitleDisplayMode.inline)
|
||||
.showNavigationBarTitle(LocalizedStringKey(title))
|
||||
.navigationBarHidden(false)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ struct AddAccountDialog: View {
|
|||
.alert(item: $errorMessage) { message in
|
||||
Alert(title: message.title, message: message.message, dismissButton: message.primaryButton)
|
||||
}
|
||||
.navigationBarTitle(Text("Add account"), displayMode: NavigationBarItem.TitleDisplayMode.inline)
|
||||
.showNavigationBarTitle("Add account")
|
||||
.navigationBarHidden(false)
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ struct TransferMoneyDialog: View {
|
|||
return Alert(title: message.title, message: message.message, dismissButton: message.primaryButton)
|
||||
}
|
||||
}
|
||||
.navigationBarTitle("Transfer Money Dialog Title", displayMode: .inline)
|
||||
.showNavigationBarTitle("Transfer Money Dialog Title")
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue