Under normal circumstances,You do not need to know the contents。
In rare cases,Your app might need to get the user presses the button information,such asThe ones released Develop a Input Method。Only then can you provide candidates to the user。
How to create an input method under macOS,I'm hereSwift uses InputMethodKit to write an input methodThis article has detailed instructions,Here skip[……]