The Hit List Diary #1 – Storyboard Merging

One of the major engineering changes for updating The Hit List has been to switch wholeheartedly to Storyboards1. I’m a huge fan of storyboards. To me, Interface Builder with plain xibs/nibs always felt too annoyingly limited in the iOS world of View Controllers for everything. Storyboards finally deliver on that promise.

Of course we’re working exclusively with Xcode 5 and later, so get to use the new file format for storyboards and xibs. The old format was a monstrosity, and certainly a valid reason to avoid using storyboards!

I’m pleased to report that the new format has been working very well in practice for us. Granted, there isn’t much in the way of multi-user editing happening. But I’m merging across three different Macs (generally all running different versions of OS X, don’t ask), and many branches.

Generally those merges go spiffingly, and conflicts are easy to resolve in a text editor. I have only two complaints so far:

At the start of each document, Interface Builder writes out the OS version of the machine that was being used for editing the file. Does this actually achieve anything? The version of the tools, yep, that makes sense. But unless you’ve written some odd code, the OS version should be irrelevant to my mind! Oh well.

You don’t even need to edit the storyboard for this to happen. Merely opening it under a different version of OS X is enough for the storyboard file to be rewritten to disk with the change in there. (rdar://17450046)

Update: Closer inspection says this only happens for some storyboards. It happens with The Hit Lists’ for example, but not with the one in my NSFetchedResultsController Stress Test.

It’s all just a bit annoying, and makes my version control commits just that little bit less clean. Still, conflicts on this line are super-easy to resolve, at least.

Secondly, there’s a list at the end of the file titled “inferredMetricsTieBreakers”. Given a view controller which can be segued to from multiple sources, it’s possible different sources result in it having a different size/layout. For display in Interface Builder, one of those sources must be chosen above the others as the size for me, the user, to edit with. I think this list determines which source view controller will be chosen for that purpose over another.

I could be completely wrong on that of course. Either way, Interface Builder seems to decide to reorder this list somewhat randomly and unpredictably. I wish it didn't! This is easily the biggest source of conflicts when merging the storyboard. Happily again, such conflicts are pretty easy to resolve by picking either version of the list; it doesn’t really seem to matter which in practice, IB is quite happy!

  1. Or maybe that should be “Storyboard”, as we have only the one, giant one at present. Yes, I can hear the angry mob from here. I don't care, I've got a big monitor :-P
© Mike Abdullah 2007-2015