https://github.com/ole/notificationunregistering
Testing the behavior of the block based NotificationCenter API. Do you have to call NotificationCenter.removeObserver(_:) or is it enough to let the observer token go out of scope? Turns out: the former (tested on iOS 11.2).
https://github.com/ole/notificationunregistering
Last synced: about 1 year ago
JSON representation
Testing the behavior of the block based NotificationCenter API. Do you have to call NotificationCenter.removeObserver(_:) or is it enough to let the observer token go out of scope? Turns out: the former (tested on iOS 11.2).
- Host: GitHub
- URL: https://github.com/ole/notificationunregistering
- Owner: ole
- Created: 2018-01-04T20:13:11.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2021-05-03T11:26:21.000Z (about 5 years ago)
- Last Synced: 2025-03-25T02:40:19.166Z (about 1 year ago)
- Language: Swift
- Homepage: https://oleb.net/blog/2018/01/notificationcenter-removeobserver/
- Size: 12.7 KB
- Stars: 17
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Do you have to manually unregister block-based NotificationCenter observers?
**tl;dr:** yes. (Tested on iOS 11.2.)
For more info, see [the accompanying article](https://oleb.net/blog/2018/01/notificationcenter-removeobserver/).
This is the test app I used to test the behavior of [`NotificationCenter.addObserver(forName:object:queue:using:)`](https://developer.apple.com/documentation/foundation/notificationcenter/1411723-addobserver) under various scenarios.