James Montgomerie’s World Wide Web Log

Easy Xcode Static Library Subprojects and Submodules

In which a method is presented for reliably building static libraries with subprojects in Xcode, and it is suggested that this method, combined with Git submodules or other similar mechanisms, provides the best way to share libraries, frameworks, or other code between projects.

I’m sure I don’t need to tell you that it’s a useful thing to be able to share code between projects. On the small end of the scale, you might have created some nice views, or text processing classes, and want to be able to include them in multiple apps. On the larger end, perhaps you produce …

Slides From "An iOS Developer's OpenGL Primer"

In October 2011 I gave a talk at the inaugural NSScotland conference in Edinburgh entitled “An iOS Developer’s OpenGL Primer”. It was an attempt to introduce iOS developers to the world of OpenGL by starting with what must be happening - pixels being displayed on screen - and working up through the layers of abstraction to UIKit. I wanted not to “teach OpenGL” (that could take up a lecture series…), but to make OpenGL seem understandable by explaining away the magic.

I promised then to put the slides online and, almost half a year - and one iOS release - …

Using the Mac or iPhone's Built In Regex Routines

In which a convenient method of using POSIX regular expressions from Objective-C is presented.

It’s a common complaint that the Mac and iPhone platforms don’t have native support for regular expressions, but that’s not entirely true. If you drop down to the UNIX core, there’s an implementation of the old (and only partially busted) POSIX regular expression interfaces. Here, I’ll show a simple Objective-C wrapper class for them that lets you use them conveniently in Mac or iPhone apps.

Before I start, some preemptive remarks: There’s a lot wrong with POSIX regexes to modern eyes. Firstly, and most glaringly, the …

Easy iPhone Application Versioning with agvtool

In which a semi-automated system for the versioning of iPhone applications is detailed. Said system ensures that the reader’s apps are always correctly versioned, and his users’ iTunes applications are never confused by an update of his beta builds.

Versioning your iPhone applications properly ensures that your app updates go smoothly, and also that when you make a beta build testers never get into the frustrating state where iTunes refuses to accept it because of versioning conflicts, leaving them to have to delete the older version, and its settings and documents along with it.

The system presented here is largely …

iPhone Images from Character Glyphs


In which a category allowing the creation of UIImages from Unicode characters, suitable for use as Tab Bar icons, is created, but a state of mild displeasure at the implementation of said category is engendered.

[If you just want code, with none o’ that darn readdin’, there’s a zip at the end of the post]

Adding a ‘test’ tab to my in-development iPhone app, I had a dilemma. My troublesome aesthetic sense was telling me that, despite being seen by no-one but me, it needed a good looking icon. My sense of efficiency, though, was telling me “No! Don’t …

Syntax of the Future Past

There is a fair amount of complaining on The Internets at the moment about Objective-C and Apple’s choice to use it for the iPhone. Many newcomers to the ‘platform’ (if I can apply a singular name to Mac and iPhone development) are finding the language - and the Cocoa frameworks based on it - very confusing. Just how can a language with sooooo many square brackets! be at-all easy to use, after all?

This provoked some deja-vu. Hadn’t, my vague memories asked me, this complaining been done before? I seemed to remember some talk of an “alternate syntax” for Objective-C …

PWD in the Title Bar (or, “A Regex Adventure in BASH”)


In which a five-minute hack to put the current working directory in the title bar of the Terminal descends into hours learning the surprising arcanities of BASH.

Like most developers, I spend a lot of time at my computer living in Terminal (and the rest Xcode)*. I have what might be a strange tendency to open a new Terminal window for each new task, I think so that I don’t have to lose the context in my current window. This means that after I’ve finished doing something (or in the middle, when I look at the screen and my obsessive-compulsive…