News for hackers. Stuff that matters.
Re:Building Automated Analytics Logging for iOS Apps by Greenisus on Tuesday May 13, 2014 @07:42PM (#7741303)
In general, people avoid subclassing in Cocoa/Cocoa Touch because you often don't know the implementation of the parent class and what effect using a subclass might have (is the parent a class cluster, etc).

Many Cocoa/Cocoa Touch APIs (NSDictionary, UIButton, etc) recommend composition over subclassing, so you'll often see people do things like add a category or swizzle methods.

I've done a little method swizzling myself, but it makes me a little nervous about side effects, so I try to only use that technique as a very last resort.

I think what they're doing here is pretty clever, but I would be uneasy about using it in a shipped app.

There are no comments on this comment yet.