Objective-C

Objective-C is the language used to program the Cocoa toolkit. It is a thin layer on top of C with a little additional syntax, a runtime component, and a big pile of metadata to support the dynamic nature of the language. But fundamentally, Objective-C is still C. Many programmers forget Objective-C’s C heritage and fail to take advantage of C’s language features and libraries.

C callbacks in Objective-C

A question that comes up fairly frequently in online forums is, How do I put a method into a function pointer? Nine times out of ten, the poster actually wants to use Cocoa with an existing C API that uses callbacks. A much better question is, I’m using a C API that uses callbacks with Cocoa, how do I make it work?

Even though ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.