Tuesday, May 6, 2014

Stopped Using NIBs Thanks to Auto Layout

Kirby Turner:

Because I use Auto Layout in code I realized overtime I was using Interface Builder only to define the UI elements that made up the view. I would define all the Auto Layout constraints in code. This got me thinking, why do I need to define the UI elements in IB? So I did a small project with no NIBs or storyboards, and I loved it. I felt more productive, and I was banging my head against the wall a hell of a lot less.

[…]

I’ve now done a number of iOS projects where I don’t use a single NIB or storyboard, and I’m convinced this is the right approach for me. I see everything regarding a view and its subviews explicitly defined in source code, which makes it easier to see what’s going on and to make changes. No more bouncing between inspectors to figure out what is causing a problem or to understand how a view is rendered. I see it all in the source code defined in a single .m file.

Code is also much better at factoring out common sub-layouts and localized strings.

4 Comments RSS · Twitter

I would call that a regression in the development process and the final blow to the ability for end-users (on OS X) to modify the UI when needed *.

* I once had to fix an old version of iPhoto UI for keywords as the window was too small for my needs. This would have proved more complex to do with the move to xib. And now with the all-in-code UI, I would have been screwed.

@someone I imagine if you tried to do that with the current version of iPhoto it would break the code signature, which would render the app unable to communicate with iCloud.

I could always sign the modified version of iPhoto with my Developer ID (for my own usage). I don't care at all about iCloud.

[…] How Much, or How Little, I Use Interface Builder These Days, Stopped Using NIBs Thanks to Auto Layout, Decoding Old Nibs: a Sad Tale of Vendor Lock-in and […]

Leave a Comment