Recently, I was invited to speak at NSMeetup, a local meetup for Objective-C developers. Since I had recently been programming against the Objective-C runtime, I offered to give a talk on the subject. The idea took off, but it soon became clear that people were more interested in knowing how the runtime works conceptually than what its public facing APIs were. Equipped with years of systems programming experience, I decided to jump into the heart of the Objective-C runtime, which is open source. A month later, I shared what I learned.
The talk starts at pure C and explains what C arrays and struct access looks like in memory. From there, we discussed how to achieve the same effects without type safety. Once we are free from type safety, we build a small bag of tricks that allow us to build an object-oriented library on top of portable C. Using this bag of tricks, we can better understand the conventions that Objective-C uses to allow inheritance, polymorphism, message dispatching, method swizzling, and more.
There have been a handful of requests for my slide deck, so I transcribed the more important bits and released it as a PDF. I hope you find it useful. If you find any errors in the deck, please let me know. I’ll issue an update and give you credit in the transcript for your find.