Skip to content

Comment on NSNotificationCenter with blocks considered harmful

Comments

Nice post! Are you always testing Apple's implementation details in your TDD? To me it seems the actual notification submission shouldn't be tested, only that it was called with the proper value?

Just a heads up though: The code snippet were hard to read because of the indentation. May I suggest

  cleanupObj = [[NSNotificationCenter defaultCenter]
              addObserverForName:notificationName
              object:nil
              queue:nil
              usingBlock:^(NSNotification *note) {
                // Code!
              }];
It might not be your coding style but in very narrow container, it makes it easier to read ;)
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.