The private function keyToCharacter() has an assert to make sure it is only called on the Main thread because TISGetInputSourceProperty will crash on background threads.
It would be great if Shortcut.description (which uses keyToCharacter()) had an @MainActor annotation to prevent running into issues here. I don't know if that has any implications with backwards compatibility, however.
The private function
keyToCharacter()
has an assert to make sure it is only called on the Main thread becauseTISGetInputSourceProperty
will crash on background threads.It would be great if
Shortcut.description
(which useskeyToCharacter()
) had an@MainActor
annotation to prevent running into issues here. I don't know if that has any implications with backwards compatibility, however.