Avatar ·

How to hide navigation bar on the first screen in Swift but show it on others?

Hello everyone! I'm a beginner in Swift and iOS development. I've encountered a problem while working with UINavigationController. I have an app with several screens. The first screen (ViewController) is something like a splash screen or onboarding where the navigation bar is not needed. But on the second and subsequent screens, the navigation bar should be visible (with a "Back" button and title). I tried using `self.navigationController?.navigationBar.isHidden = true` in the viewDidLoad of the first controller. This works when the screen first loads. But when I navigate to the second screen and then go back, the navigation bar remains hidden on the first screen, which is what I need. However, if I swipe back (with a gesture) on the first screen, the navigation bar sometimes flickers or behaves strangely. Here is my current code: