I used the following code to hide the status bar and it works fine But it works until I go to another page. That is, if I go to another page and go back, it won't work anymore Does anyone know why? Can anyone help me?
class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationController?.hidesBarsOnSwipe = true
    }
    override var prefersStatusBarHidden : Bool {
        if self.navigationController?.isNavigationBarHidden == true {
            return true
        } else {
            return false
        }
    }
 
     
     
     
    