After iOS 13 and Swift 5, we need a custom solution for changing status bar on iOS 13 and below. Here is how to do that:

    if #available(iOS 13.0, *) {
        let app = UIApplication.shared
        let statusBarHeight: CGFloat = app.statusBarFrame.size.height

        let statusbarView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: statusBarHeight))
        statusbarView.backgroundColor = UIColor.red
        view.addSubview(statusbarView)
    } else {
        let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView
        statusBar?.backgroundColor = UIColor.red
    }
Also, check the article [iOS 13 How to Change StatusBar Color?][1] or [Github Example: iOS StatusBar Example][2] 

One last thing, you can still change statusbar style with :

    override var preferredStatusBarStyle : UIStatusBarStyle {
       return UIStatusBarStyle.lightContent
       //return UIStatusBarStyle.default   // Make dark again
    }


  [1]: https://freakycoder.com/ios-notes-13-how-to-change-status-bar-color-1431c185e845
  [2]: https://github.com/WrathChaos/iOS-StatusBar-Example