This is going to be another one of those posts where I did something ridiculous and then show you how I got there, so let’s just get right to it.
In the Cocoa world, the big news from WWDC is the advent of Automatic Reference Counting, or ARC. The only real documentation for the system is an unlinked reference page on the Clang website, but as Clang is open source and the implementation’s in the latest builds now, that counts as public information.
The Cocoa frameworks have long used a reference-count-based system, but as of Mac OS X v10.5, Apple added optional garbage collection. As with most GC systems, you can mark certain references as
__weak (which automatically become
nil when their target is collected), and the actual collection of…
Why did I miss last week’s post? To test this!
A few posts back I suggested the use of a category’s
+load method as a way to safely swizzle methods in a plugin. What do you do, though, if the same category is going to be loaded twice?
The established behavior of categories, of course is that the last one loaded “wins”.
The behavior of classes, however, is that the first one loaded wins.
That is, if a bundle defines a class with the same name as an existing class, it is not loaded.
[bundle principalClass] returns the existing…