My first GPOYW! From a lobster bake in Eastham, MA. Picture courtesy of cheeryobs.
Private methods in Obj-C
Objective-C handles public/private/protected declarations differently than the languages of my current day-job (ActionScript3 and Java). I spent some time today looking into some differences with static accessors - namely, that “static” variables are class-specific declarations in Obj-C, whereas “extern” serves as a public static. Instance variables are by default protected, but can easily be marked @private or @public in a class’s header file.
Obj-C makes no difference among public/private/protected methods. I came across a really useful workaround for this language feature on StackOverflow. Basically, Obj-C 2.0 allows for the declaration of “empty categories” (categories are sort of like namespaced prototype changes) within a class implementation file, in which you can declare your “private” methods. Pretty useful!




