Navigation bar behaviour in swift
<p>I have three view controllers and they are embedded in navigation controller.</p>

<p>The architecture is the following:
<a href="https://i.stack.imgur.com/WLWVF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WLWVF.png" alt="enter image description here"></a></p>

<p>I want to hide navigation bar from first view controller. </p>

<p>For this purpose I use </p>

<pre><code>navigationController?.setNavigationBarHidden(true, animated: true)
</code></pre>

<p>in viewdidload method(for first controller).
The same is used in two other controllers but with false parameter to enable navigation bar. </p>

<p>When I load application - all is good, NB is disabled, when I go to second controller also all is fine - it is enabled. BUT! When I press back button on navigation bar of second controller and it sends user to first controller - navigation bar is enabled there. </p>

<p>Is there a special method which should be used when we return back to controller? Can anybody explain this to me? Really appreciate your help.</p>