Home | Developer Blog

Stopwatch timing in Cocoa

Sometimes you want to time things in your code. The usual pattern is to store the current time, do something, store the current time, compute the difference, and then convert it to something useful, like seconds elapsed. That pattern gets old fast, so here’s a little Cocoa stopwatch class that neatly encapsulates stopwatch timing on Mac OS X.

Read More…

Interface Builder tips

Xcode 3 was a pretty significant upgrade, and included some desperately needed improvements to Interface Builder. Now, although the new version of Interface Builder is significantly improved, it still suffers from some eccentricities and a lack of good example-driven documentation. It’s an amazingly powerful tool, but a lot of its features can be somewhat hard to discover without help. This post contains a few things I’ve discovered about Interface Builder over time that I’ve found really useful.

Read More…

Strange Leopard key binding bug

Muscle memory is a powerful thing. I’ve been using Mac OS X for over six years, but my history with Windows, and DOS before it, have defined how my brain expects certain tasks to map to keys on the keyboard. I’ve never gotten used to the text editing key bindings on Mac OS X. I grew up with things like CONTROL-LEFT and CONTROL-RIGHT moving the cursor by a word, and SHIFT-DELETE, CONTROL-INSERT, and SHIFT-INSERT being cut, copy and paste respectively. Luckily, Mac OS X provides for customization of key bindings, and I managed to create a set of key bindings that met most of my needs… Until Leopard arrived.

Read More…

Automated build numbering in Xcode

One thing I like to do in any development project is generate a build number, and I want it to be an automated process. This number represents the version of the source code that was used for the build. Coupled with source code control, this enables you track the version of the source code that corresponds to a customer’s installation of the product. In a large team with centralized builds, you typically increment the build number on every centralized build, whether they are kicked off on a time basis, or a check-in basis. For a single developer project, it’s nice to be able to increment the build number for every build you make locally. Here’s a simple way to enable automated build numbering in Xcode for a single developer project.

Read More…