In AppKit, you can set up a menu item so that it invokes a selector in the first responder. If memory serves, you do that by setting its target to nil, and then the system walks the responder chain, looking for a responder that implements that selector. If it finds one, it enables the menu item and links it to the responder. If not, it disables the menu item.
I'd like to add a menu item that acts on the front-most window (Swapping between pairs of TextFields.) If the front-most window supports the menu item, I'd like it to be enabled, and disabled if not.
In AppKit, I'd give the menu item a selector that I implemented one of the window's responders. (Maybe the window controller, maybe the view controller. I'd have to decide what made the most sense.)
How would I achieve that in a SwiftUI app?