periphery
periphery copied to clipboard
Notification token unused warning should be ignored by default
I registered a notification handler with a token, I don't need to access it again because Notification Center will remove it automatically if token was destoried.
Code example:
class A {
var token: NSObjectProtocol?
func addNoti() {
token = NotificationCenter.default.addObserver(
forName: UIApplication.didBecomeActiveNotification,
object: nil,
queue: .main
) { _ in
// do something
}
}
}
In periphery 2.9.0, It gives me a warning 「Property 'token' is assigned, but never used」This warning should be ignored by default.