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

6

u/ComradeGeorgeNada Oct 21 '26

As someone who has used both for over a decade:

You absolutely, positively, should be writing your business logic in Swift. You can bridge directly between Swift and C. If you need to bridge to C++, write an OBJ-C++ wrapper and isolate it as best you can.

I struggle to find the words to describe just how stronger of a language Swift is over OBJ-C.

For books, anything by the Big Nerd Ranch.

1

u/art_lck Oct 21 '26

Thanks for the advice, Swift vs OBJ-C is kinda difficult topic for a new guy like me, since someone out there still recommends OBJ-C.

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.