An open API service indexing awesome lists of open source software.

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).

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.