onExitCommand(perform:)
Sets up an action that triggers in response to receiving the exit command while the view has focus.
Declaration
nonisolated func onExitCommand(perform action: (() -> Void)?) -> some View
Discussion
The user generates an exit command by pressing the Menu button on tvOS, or the escape key on macOS.