In Objective-C on macOS, the method [[NSWorkspace sharedWorkspace] runningApplications]
can be used to get a list of the running applications on the system.
However, per Apple's documentation, the order of applications in the returned array is undefined.
I'd like to get a list of the running applications in the order in which they would appear if the user were to press Cmd+Tab; that is, in the "Z-order" of how recently each application was the frontmost application.
How can this be done?