I ended up completely replacing the back button:
override func viewDidLoad() {
super.viewDidLoad()
let imageConfig = UIImage.SymbolConfiguration(pointSize: 24, weight: .unspecified, scale: .default)
let image = UIImage(systemName: "chevron.left", withConfiguration: imageConfig)
let backButton = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(clickBackButton))
backButton.hidesSharedBackground = true
backButton.tintColor = .blue
self.navigationItem.leftBarButtonItem = backButton
}
@objc func clickBackButton() {
self.navigationController?.popViewController(animated: true)
}
The only downside I see so far is that the long-press on the back button to show a menu of the navigation stack is no longer available.