setNavigationBarHidden not working on iOS 15

I'm having troubles with the method setNavigationBarHidden, it doesn't seem to work properly on iOS 15.

I am currently working with this structure:

  1. A ViewController, which needs the navigationBar
  2. Another ViewController, pushed from the previous when I tap a UIButton, which doesn't need the navigationBar

On the previous versions of iOS, I simply called setNavigationBarHidden(true, animated: true) in the viewWillAppear method of the second ViewController and everything worked as expected but, from the new version of iOS, that doesn't occur correctly.

Now the navigationBar doesn't hide properly and, the only way I have to achieve the behavior I want, is by using the navigationBar.isHidden = true, which unfortunately leads me in a sloppy and not so smooth animation between the two controllers.

How can I solve this?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum