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.
We should remove notification also.
Ex.
deinit { NotificationCenter.default.removeObserver(self, name:NSNotification.Name(rawValue: "notify"), object: nil) }