I want to remove the text from the back button, but I want to keep the icon. I have tried
let backButton = UIBarButtonItem(title: \"\", style: UIBarButtonIt
One alternative to override all ViewControllers for me was to extend UINavigationController and set the backBarButtonItem of the topViewController.
Swift 5 on Xcode 11.2.1:
extension UINavigationController {
override open func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let backButton = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)
self.topViewController?.navigationItem.backBarButtonItem = backButton
}
}