Toggle the iOS Simulator software keyboard ("Connect Hardware Keyboard") from the command line, without rebooting the simulator.
simctl and devicectl have no option for this, and Xcode 27 replaced Simulator.app with Device Hub, whose "Simulate hardware keyboard" setting has no command-line or AppleScript interface. This script calls the private CoreSimulator API that controls the hardware keyboard connection: SimDevice setHardwareKeyboardEnabled:keyboardType:error:.
Useful when the software keyboard is not showing in the simulator, for example after an automation tool typed text and the simulator switched to the hardware keyboard.