In order to perform some verifications when the back button is pushed on a UINavigationController.
I decided, after searching the net on how to do that, to subclass UINavigationController and implement the UINavigationBarDelegate.
Here is my problem:
as long as I do not actually implement anything of the UINavigationBarDelegate protocol it all works as when I was using a plain UINavigationController. But when I implement only this function:
func navigationBar(_ navigationBar: UINavigationBar,
shouldPop item: UINavigationItem) -> Bool {
print(#function)
return true
}
I can see in the debugging console that the function is actually called. But the pop does not happen, only the back button vanishes, the view stays there. I expect that with only the function above it should still work as before (i.e. the view should pop out normally).
Anyone can see the thing I am missing?