Change Status Bar Hintergrundfarbe in Swift 3

In XCode 7.3.x habe ich die Hintergrundfarbe für meine StatusBar geändert mit:

func setStatusBarBackgroundColor(color: UIColor) {
guard  let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
    return
}
statusBar.backgroundColor = color
}

Aber es scheint, dass dies mit Swift 3.0 nicht mehr funktioniert.

Ill versuchte mit:

func setStatusBarBackgroundColor(color: UIColor) {
guard  let statusBar = (UIApplication.shared.value(forKey: "statusBarWindow") as AnyObject).value(forKey: "statusBar") as? UIView else {
    return
}
statusBar.backgroundColor = color
}

Aber es gibt mir:

this class is not key value coding-compliant for the key statusBar.

Ideen, wie man es mit XCode8 / Swift 3.0 ändert?

Antworten auf die Frage(18)

Ihre Antwort auf die Frage