Hacker News new | ask | show | jobs
by gwbas1c 1226 days ago
Just do it.

I started with one of the Big Nerd Ranch books many years ago. I spent a few evenings reading it, and then spent a few hours dabbling with Objective C in XCode. I then got frustrated and put it down for a few years until I took a job that involved some Objective C. (This was over a decade ago.)

It's surprisingly easy to learn the details of system calls by Googling and looking at stack overflow. Yes, the semantics are different, but the general theory is the same. There's a main thread that's often referred to as the main run loop. Accessing your UI outside of the main run loop (thread) is a big no-no.

As much as I want to vouch for learning Swift, (it's really easy if you have a Java / C# background,) there's also a good reason to be proficient in Objective C: It's just a layer on top of C. It's very easy to wrap C APIs in Objective C and then call them from Swift. This is important, because if you're trying to do something low-level, you will need to interact with a C API. (Although, Swift fixes a lot of the weirdness of Objective C if all you want is something that's like Java / C#.)

FWIW: There are some semantic differences that can take some time to adjust to. In Objective C, sending a message to a null object is a no-op instead of a runtime exception. Swift appears memory safe, but I've done things with timers that cause surprise crashes.

1 comments

Swift interops with C directly so there’s no need to wrap in Objective-C.
I just skimmed an article about that. That's quite nice.

FWIW: One of the things I really appreciated in Objective C was that I could use real C when working with a C library. It wasn't something I did often, though. But, IMO, it's definitely something that someone who wants to do low-level Mac programming should learn. Sometimes it's just easier to work with a library in C.