There's a billion answers here so I thought why not add another in the form of an extension (with help from @Cœur)
extension UIApplication {
class var statusBarBackgroundColor: UIColor? {
get {
return (shared.value(forKey: "statusBar") as? UIView)?.backgroundColor
} set {
(shared.value(forKey: "statusBar") as? UIView)?.backgroundColor = newValue
}
}
}
UIApplication.statusBarBackgroundColor = .blue