Simulates key press in Swift on macOS.
Pressing key A:
import keypress
keypress.press("A")
Simulating the typing of the following text:
keypress.write("Hello World")
Pressing hotkey Command+A:
keypress.hotkey("Command", "A")
Add the following line to the dependencies
in Package.swift
:
.package(url: "https://github.com/meowmeowmeowcat/keypress", from: "0.0.4"),