I'm currently working on a heatmap implementation in certain app. The keycodes are stored independently of their characters (since I want this heatmap to be keyboard layout agnostic). Ill be rendering the heatmap itself on the given view collection:
Question is: how do I correctly link a keyCode, say 5 for G on a typical US style Qwerty keyboard, to the correct Unicode character. I can keep this blank but I want it to render the user's current keyboard layout on the heatmap itself.
I've looked at the file AppleKeyboardLayouts-L.dat
which seems to contain the data I need; but it's hard to interpret. I've so far been able to find out that the header contains the location of the keyboard layout data itself, the location of the PNG icons they use system wide and some other metadata. While this was a fun reversing past (waste of?) time there is probably a lower level framework e.g. CoreServices or maybe CoreText that could do this for me.
Some sniffing around lead me to this specific structure in CoreServices, which might be on the right track but honestly this is far deeper than I've ever dug in any of the string related API's in macOS. UCKeyboardLayout Apple Developer documentation