Category Archives: Class design

Keeping ViewController files small

If you’re working on a complex iOS app, it’s very easy to create a UIViewController subclass with a huge amount of code. One of the many code guidelines I learned at Google was the simple idea of keeping functions and files small. For example, I would recommend trying to keep the vast majority of your […]

Introducing the Default Delegate design pattern

I recently posted an overview of callback mechanisms in Objective-C, including the pros and cons of delegates versus target/action pairs; in this post I’ll introduce a new design pattern that combines many of the benefits of both of these approaches into a single technique. If you’re building a class to be reused many times, it […]


In this post, I’ll enumerate four major types of callback mechanisms in Objective-C, and mention some comparisons to help choose the best one for whichever class you’re designing. Intuitively, a callback is a method that you think of as being called from outside your code. More formally, a callback is a method that can be […]