Get all shortcuts without maintenance / Automatic conformance to CaseIterable
Having to add all Shortcuts to .allCases manually can be tedious. I tried to solve with mirror API but it doesn't take static properties.
Yeah, this is blocked by Swift having better reflection abilities.
Why do you need to get all the shortcuts? Maybe there's a better way to solve your problem.
I list all shortcuts in app preferences for the user to assign what he needs. Currently it’s 31.
I assume you need a label for each shortcut and those have to be stored somewhere, so I think you need an array regardless. Hard for be to know without knowing exactly how your app is structured though.
I thought i have to declare a static let for each KeyboardShortcut.Name. I found out i can simply dynamically initialize with a string and that store in an array or other structure. All fine.