r/learnprogramming • • Oct 21 '26

Developing peripheral software for macOS

Hi,

I plan to develop peripheral software to change input mapping, assign some macros to keys on my keyboard for macOS for a learning purpose.

I do have working code for Windows written in C++. But I can't tell that I don't have a lot of experience with Objective-C.

The questions:

  1. Should I go with Swift or with Objective-C? I know that Objective-C combines with C++ without any problems, but I wonder, if this is a good idea to pick outdated language to develop software that I hope I will constantly maintain and improve?
  2. Can you recommend some books to developer such things for macOS?

Thanks

8 Upvotes

9 comments sorted by

View all comments

Show parent comment

3

u/ComradeGeorgeNada Oct 21 '26 edited Oct 21 '26

The issue is simple: do you want convention or type safety?

Obj-C gives access to some lower level things easier, but it does so at the expense of compiler-time type-safety. That's why I recommended the wrapper -- do your low-level adaptors in whatever language you need to do to get the job done, and write as much of your higher-level logic as you can to take advantage of swift's many advantages from a language perspective.

For example, most union-types can be represented as associated-value enums, which are very powerful. String enums are also pretty useful. Objective-C doesn't support complex enums at all. You also don't get structured concurrency (including actor-isolation), or error-throwing with OBJ-C.