You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discarded Notification Center Observer Violation is triggered when I use the below code pattern where the notification observer result is appended to an array instead of assigning it to a variable.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint App/NotificationController.swift
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths App/NotificationController.swift
Linting 'NotificationController.swift' (1/1)
/Users/jsloop/dev/App/App/NotificationController.swift:34:27: warning: Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
/Users/jsloop/dev/App/App/NotificationController.swift:36:27: warning: Discarded Notification Center Observer Violation: When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later. (discarded_notification_center_observer)
Done linting! Found 2 violations, 0 serious in 1 file.
New Issue Checklist
Describe the bug
Discarded Notification Center Observer Violation is triggered when I use the below code pattern where the notification observer result is appended to an array instead of assigning it to a variable.
Complete output when running SwiftLint, including the stack trace and command used
Environment
If I assign the return to a variable, the violation is not triggered.
The text was updated successfully, but these errors were encountered: