Xcode's type-to-filter menus are built into AppKit — enable them in any app with one defaults command

zats · x · 2026-10-18

Developer zats set out to rebuild Xcode's type-to-filter menus, only to discover the feature is already built into AppKit (spotted in macOS 27+). Any NSMenu can get it: the simplest route is defaults write <app-bundle-id> NSMenuUseFilteringByDefault -bool YES, which works code-free for apps with 6+ menu items. Alternatively, use the private API — guard on responds(to: Selector(("setTypingBehavior:"))), set typingBehavior to 2 for filtering or 3 for selecting, and hook NSMenu.didBeginTrackingNotification to recursively apply it to every menu in the app, SwiftUI included. Caveat: filtering only works well on first-level menu items.

Original post →

More from coding & agent

coding & agent channel →