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
If you have a ViewControllerA and you want to navigate to the ViewControllerB, in the ViewControllerA, you should set the current navigationItem with a new UIBarButtonItem and the title to a string with blank space before push to another view controller:
Set the title to a string with a blank space, you can't set nil or "" (empty string) because the default value is nil
let backItem = UIBarButtonItem()
backItem.title = " "
navigationItem.backBarButtonItem = backItem
let controllerB = ViewControllerB()
navigationController?.pushViewController(controllerB, animated: true)