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
I've tried a couple of answers and I can't get them to work in all cases. So this is a workaround to not affect the title of the navigation bar if it's set.
guard let items = viewController.navigationController?.navigationBar.items else { return }
for item in items {
if item.title == nil {
item.title = ""
}
}