"Change" status bar background color:
let statusBarView = UIView(frame: UIApplication.shared.statusBarFrame)
let statusBarColor = UIColor(red: 32/255, green: 149/255, blue: 215/255, alpha: 1.0)
statusBarView.backgroundColor = statusBarColor
view.addSubview(statusBarView)
Change status bar text color:
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
**Update:** please note that the status bar frame will change when the view is rotated. You could update the created subview frame by:
- Observing `NSNotification.Name.UIApplicationWillChangeStatusBarOrientation`
- Or overriding `viewWillLayoutSubviews()`