The Business Value of Auto Layout

March 2, 2015

I’ll admit it. I’ve been running away, hiding from, and trying to just plain ignore Auto Layout, hoping it would go away. Despite having successfully pulled off numerous Jack Bauer-style maneuvers to escape it, I’m finally having to face into Auto Layout. It feels a lot like the final “Hello Beastie” scene in Dead Man’s Chest.

The Kraken or Auto Layout?

My Auto Layout phobia is not about learning new tech – it’s about having to significantly alter my development plans and the subsequent impact that will have on my business. I don’t want to stop and spend time ripping apart a perfectly working springs and struts-based app. I’d have to rework a rather complicated (for me, anyway) dynamic view hierarchy, undoubtedly have to track down a bunch of new bugs, and do a ton of regression testing. I saw no sense or customer value in any of that. So what pushed me over the edge?

My primary app is NextPage, a sheet music manager designed for live performance. I built it for the original iPad (iOS 4.3, I think) because I felt the screen was big enough in portrait mode to make a full page of sheet music easily readable1. The original challenge with the app was not about getting the UIScrollView laid out properly2. That was pretty much a simple matter of adding subviews for each page of music at the correct offsets and maintaining the contentSize property of the scroll view. Since I didn’t plan to support landscape mode, I hardly bothered to even look at the springs and struts setup. I was determined to release the app by the time iPad 1 hit the stores, so I didn’t do anything more than I had absolutely had to3.

That was 2009, and I’ve never gone back and touched that pre-storyboard era xib again. Whether it was Storyboards or Auto Layout, I could never justify putting those in just because it was the latest hotness. Why? Because I’ve learned that when you have to touch something a second time, there’s going to be a significant cost. In this case, that would be:

  1. Opportunity Cost – The time could be better spent developing new features, or other apps.
  2. Support Costs – New bugs will invariably be introduced that will escape your testing regime, and they will requiring fixing.
  3. Black Eye Cost – If any new bugs that hit the street are bad enough, you can be sure that the one-star review crowd will appear with firebrands and pitchforks.

With all that in mind, I could easily justify turning a blind eye to Auto Layout for NextPage. There was no business value in using it, in fact, you might say there would have been anti-value4.

Now, however, the rumors of a larger iPad are ringer louder every day, and I can feel it in me bones that it’s probably going to come true Real Soon Now. And at the same, the cries from my users for landscape support, zooming, and cropping, have been growing louder as well. All signs are pointing to a major revamp of the NextPage view hierarchy, and Auto Layout is clearly going to be the right tool for the job.

We all know (and I finally accept) that Apple is pushing us to build universal apps. Now that a bigger device is ostensibly on the horizon that I care about, I can more easily see the business need for tech like Auto Layout and Adaptive Layout.

I don’t feel bad about waiting this long, because I could justify it for business reasons. I just feel a lot of anxiety about playing catch-up, because I basically ignored Auto Layout completely all this time. So, I’ve been doing a ton of tutorial work (Thank you, Ray Wenderlich, for your awesome Auto Layout tutorials!), WWDC videos, and building prototypes. I really want to be sure I know what I’m doing before I take the knife to NextPage.

I can see already that if I do the work correctly, the time investment is going to pay off in a big way, because I’ll be ready for The Bigger iPad, whenever it arrives, for basically no additional work. For me, that’s real business value.

But I’m not on an infinite time scale, and all this prep time is starting to make me cranky. I’ve spent at least seven or eight 90-minute work cycles just learning AutoLayout and trying to coax a constraint-laden UIScrollView to do my bidding5. I’ve been spooked by the whole thing a couple of times and been tempted to punt, but since I can now see the value, I’ve got the incentive needed to win.


 

  1. When I say “sheet music”, I mean a full piano score with both clefs, where there’s usually a lot more going on than in a chord chart or lead sheet.
  2. It was all about getting the PDF images to render fast enough.
  3. Someone other than me would later coin the phrase “minimal viable product” for this technique and become famous.
  4. I’m writing this on the day Leonard Nimoy died, so please forgive the anti-matter/anti-value overlay…
  5. Tip: Under AL, UIScrollView automatically calculates its contentSize property based on the constraints of it’s subviews. Apple documents the behavior here.

Previous post:

Next post: