title: iOS 13: threading violation: expected the main thread
body: <p>The app is being crashed when trying to hide the navigation bar for a viewcontroller only for <strong>iOS 13</strong> users.</p>
  <ul>
  <li>I got the crash on Crashlytics of Fabric which titled as below,</li>
  </ul>
  <blockquote>
  <p>Fatal Exception: NSInternalInconsistencyException</p>
  <p>threading violation: expected the main thread</p>
  </blockquote>
  <ul>
  <li>The app is being crashed on this line of viewWillAppear method,</li>
  </ul>
  <pre><code>    self.navigationController?.isNavigationBarHidden = true
  </code></pre>
  <ul>
  <li>To hide the navigation bar on the viewWillAppear method of UIViewController, I am using below code,</li>
  </ul>
  <pre><code>    override func viewWillAppear(_ animated: Bool) {
          self.navigationController?.isNavigationBarHidden = true
          super.viewWillAppear(animated)
      }
  </code></pre>
  <ul>
  <li>To show the navigation bar on the viewWillDisappear method of UIViewController, I am using below code,</li>
  </ul>
  <pre><code>    override func viewWillDisappear(_ animated: Bool) {
          self.navigationController?.isNavigationBarHidden = false
          super.viewWillDisappear(animated)
      }
  </code></pre>