How do you add an observer in Swift to the default notification center? I\'m trying to port this line of code that sends a notification when the battery level changes.
In swift 2.2 - XCode 7.3, we use #selector for NSNotificationCenter
#selector
NSNotificationCenter
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(rotate), name: UIDeviceOrientationDidChangeNotification, object: nil)