Debugging NSNotificationCenter and NSRunLoop
The
debugDescriptionproperty has been around for quite awhile. Formally first appearing as a@propertyon NSObject in iOS 5 and macOS 10.8, it came across into Swift as a member of theCustomDebugStringConvertibleprotocol, and continues to be incredibly useful today.[…]
I don’t remember why I decided to try printing plain old
NSNotificationCenter.defaultCenterin 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[…]
NSRunLoop/CFRunLoopalso provides a very detaileddebugDescription.