I was reminded over the weekend why I love developing software for Apple products, and that I haven’t done nearly enough of it recently. Having spent almost 25 years of my life developing for the Apple II, and the odd thing here and there for the Mac, I thought I should take a look at Apple’s latest Xcode IDE for OS X. Nice. 🙂 (By the way, OS X is pronounced “oh ess ten”)
I’ll probably blog about it later, but I decided to build a virtual radio broadcasting mixer, after being disappointed at what I found on the Internet when I went looking.
Anyway, Xcode is Apple’s current development environment, which includes a funky app called Interface Builder. Interface Builder lets you build all your UI, as you would in any modern IDE, but includes a few extra cool features.
OS X is built around Objective-C and the MVC design pattern, and the name Interface Builder comes from the fact that you use it to visually model your MVC including Objective-C outlets and actions.
When you start lining up controls for a window in Interface Builder, instead of fixed grid sizes like in most IDEs, it generates dynamic grids based on the Apple Human Interface Guidelines. For example, “push button” controls can be 20, 17 or 15 pixels in height, but must be 12, 10 or 8 pixels vertically and horizontally spaced respectively. Certain reserved buttons, like Cancel and OK, must be 68 pixels wide. Lining these controls up in the old days consisted of either manually plugging in values (before we had visual resource editors), or lining them up on dodgey fixed grids that took no notice of controls widths, heights and embellishments.
Well, when you drag controls around in Interface Builder, a dynamic grid is displayed, with line guides wherever an appropriate grid snap should be. In the screen shot, you can see guides for the button text baseline, the bottom button align, the minimum horizontal button spacing, and the right align with the list control. Move the target button around, and guides appear or disappear as appropriate, and the control will snap to a guide when within about two pixels of it. Considering that all OS X controls have an inner frame which is the alignment border, and an outer variable size embellishment frame for the 3D and shadowing effects, this is a life saver.
More on the mixer later, but no wonder there’s a lot of software coming out for OS X. The tools are great, and Objective-C with Interface Builder and other tools is a breeze to use.