Debugging NSNotificationCenter and NSRunLoop
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 theCustomDebugStringConvertible
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[…]
NSRunLoop
/CFRunLoop
also provides a very detaileddebugDescription
.