The ⌘> on the Simulator’s Touch Bar is equivalent to the “Hardware” » “Keyboard” » “Send Keyboard Shortcuts to Device”.
For example, let’s say your app detected command+S pressed on a physical keyboard attached to a physical device via keyCommands
:
class ViewController: UIViewController {
override var keyCommands: [UIKeyCommand]? {
return [UIKeyCommand(input: "s", modifierFlags: .command, action: #selector(didPressCommandS(_:)))]
}
@objc func didPressCommandS(_ keyCommand: UIKeyCommand) {
print(#function, keyCommand)
}
}
Usually, though, if you press command+S in the simulator it takes a screen snapshot. But if you turn on this “Send Keyboard Shortcuts to Device” (whether through the Touch Bar or via the simulator’s menu), it will call your UIKeyCommand
selector, just like it would on a physical device.