Well, back bar buttons title changes to "Back" when title of the previous viewController is too long to fit the space within the button.
I want to change the title to something else when it says "Back", so I thought I can do something like that:
if navigationItem.backBarButtonItem.title == "Back" {
navigationItem.backBarButtonItem.title = "SomeThing"
}
But title (or its parent view) always returns nil
.
Also, where to put the code: in the pushing or pushed viewController?
Thanks.
EDIT: The approved answer in the link
How to set back button text in Swift
is different, because I want to change the title only in the case it is too long to fit inside the button label.