title: IOS13 Status Bar Background Color doesn't change to transparent after being set
body: <p>(IOS13) I am trying to implement the functionality that shows the navigation bar and status bar gradually after scrolling down the page (with the following code): </p>
  
  <pre><code>override func scrollViewDidScroll(_ scrollView: UIScrollView) {
      var offset = scrollView.contentOffset.y / 150
      print(offset)
      if offset &gt; 1 { // show navigation bar
  
          offset = 1
          let color = UIColor.init(red: 1, green: 1, blue: 1, alpha: offset)
  
          self.navigationController?.navigationBar.barStyle = .default
          self.navigationController?.navigationBar.tintColor = UIColor(hue: 1, saturation: offset, brightness: 1, alpha: 1)
          self.navigationController?.navigationBar.backgroundColor = color
          navigationController?.setStatusBar(backgroundColor: color)
  
  
      } else { // hide navigation bar
  
          let color = UIColor.init(red: 1, green: 1, blue: 1, alpha: offset)
  
          self.navigationController?.navigationBar.tintColor = UIColor(hue: 1, saturation: offset, brightness: 1, alpha: 1)
          self.navigationController?.navigationBar.backgroundColor = color
           navigationController?.setStatusBar(backgroundColor: color)
  
          self.navigationController?.navigationBar.barStyle = .black
  
      }
  }
  </code></pre>
  
  <p>The navigation bar works perfectly. However, the status bar doesn't change back to the transparent color when I scroll back up. [Screenshots below] </p>
  
  <p><a href="https://i.stack.imgur.com/5FKlJ.png" rel="nofollow noreferrer">Initial State</a></p>
  
  <p><a href="https://i.stack.imgur.com/lBLhl.png" rel="nofollow noreferrer">Scroll A little bit</a></p>
  
  <p><a href="https://i.stack.imgur.com/K3L4R.png" rel="nofollow noreferrer">Scroll Back to initial State</a></p>
  
  <p>I used this piece of code to update the status bar color: </p>
  
  <pre><code>extension UINavigationController {
  
  func setStatusBar(backgroundColor: UIColor) {
      let statusBarFrame: CGRect
      if #available(iOS 13.0, *) {
          statusBarFrame = view.window?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero
      } else {
          statusBarFrame = UIApplication.shared.statusBarFrame
      }
      let statusBarView = UIView(frame: statusBarFrame)
      statusBarView.backgroundColor = backgroundColor
      view.addSubview(statusBarView)
  }
  </code></pre>
  
  <p>}</p>