Friday, February 23, 2018

Debugging NSNotificationCenter and NSRunLoop

Tim Ekl:

The debugDescription property has been around for quite awhile. Formally first appearing as a @property on NSObject in iOS 5 and macOS 10.8, it came across into Swift as a member of the CustomDebugStringConvertible protocol, and continues to be incredibly useful today.

[…]

I don’t remember why I decided to try printing plain old NSNotificationCenter.defaultCenter in lldb, but I do remember being very surprised at the output. Rather than a plain object class-name-and-pointer pair like most things return, I found a long list of registered notification observers, complete with column headers[…]

Rob Mayoff:

NSRunLoop/CFRunLoop also provides a very detailed debugDescription.

Comments RSS · Twitter

Leave a Comment