sindresorhus/KeyboardShortcuts

Annotate `Shortcut/description` with @MainActor to prevent crashes

greimers opened this issue · 0 comments

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.