ios swift swift4 xcode xcode9

Hide Navigation Bar for a View Controller

I’ve tried to hide the navigation controller for a single view controller with no luck, the navigation bar is hidden for the first vc, but it’s not displaying for the second vc.

Here’s the code I’ve used in the first vc:

override func viewWillAppear(_ animated: Bool) {
// Hide the Navigation Bar
self.navigationController?.setNavigationBarHidden(true, animated: animated)
override func viewWillDisappear(_ animated: Bool) {
// Show the Navigation Bar
self.navigationController?.setNavigationBarHidden(false, animated: animated)

What’s changed in swift 4? That code worked in swift 3…