I had use
UIApplication.shared.addObserver(self, forKeyPath: "statusBarHidden", options: .new, context: nil)
and listen
override func addObserver(_ observer: NSObject, forKeyPath keyPath: String, options: NSKeyValueObservingOptions = [], context: UnsafeMutableRawPointer?) {
if keyPath == "statusBarHidden" {
print("statusBarHidden")
}
}
but not working in IOS 11 (Swift 4).
How to add KVO when statusBar is Hidden or show.