_eventFirstResponderChainDescription
AppKit includes a private category on
NSApplication
that adds_eventFirstResponderChainDescription
— a string describing the current responder chain. This can be a really useful debugging tool!When your views aren’t handling input events in the way you’d expect, consider dropping this extension into your project to see what’s what[…]
Update (2024-03-25): You can also set the _NS_4445425547
user default to see a Cocoa debug menu. I tend to just leave this enabled in my apps.
Update (2024-04-11): Antoine:
Today’s Darwin crazy hidden debugging tool of the day: iOS has a built in HUD for showing performance statistics like FPS, frame duration etc. […] This HUD can be activated by calling the private
CARenderServerSetDebugOption
function
See also: Marcin Krzyzanowski.
6 Comments RSS · Twitter · Mastodon
I always pass `-_NS_4445425547 YES` when debugging from Xcode, which gives a nice extra menu item 🐞 with — among other goodies — a window that lists the current responder chain.
Nice find. This is a little simpler way to print the value:
print(NSApp.value(forKey: "_eventFirstResponderChainDescription"))
And that _NS_4445425547 thing is really neat!
I wondered if that user default could be injected easily into every app with a “defaults” command, and indeed you can!
defaults write -g _NS_4445425547 -bool true
And in case anyone’s wondering what the 4445425547 means:
0x44 = d
0x45 = e
0x42 = b
0x55 = u
0x47 = g
🤓👍