Monthly Archives: April 2011

Fast low-level arrays

Some apps need fast processing involving variable-length arrays. NSMutableArray is pretty efficient and easy-to-use, but it requires a lot of Objective-C overhead. In this post, I introduce CArray, a low-level, superfast framework for variable-length arrays. CArray is useful when: You’re working with C data types — pointers or primitive types or structs thereof; speed is […]

Repeating an animation at changing speeds

I recently came across the following problem: I wanted to handle a repeated animation that would continuously change its speed over time. In particular, I’m building a game with a flashing square, and I want it to flash more quickly if the player is getting closer to dying. Conceptually, this is very easy, and it’s […]


It’s surprisingly tricky just to draw a single line in iOS. Quartz has great 2D graphic support, but you need to dive down into that world and use many lines of code to draw one line. In some cases, you really just want a few well-placed lines to augment an elegant UI – this class […]