Monday, May 1, 2017

Life Without Interface Builder

Zeplin (via Andy Bargh):

Interestingly enough, we started thinking about dropping Interface Builder only after we’ve started using Swift.

[…]

Using Swift with Interface Builder brings many optionals to the table and they don’t belong in a type-safe domain. I’m not just talking about outlets either, if you are using Storyboards with segues, your data model properties also become optionals. This is where things get out of hand. Properties that are required for your view controller to work properly are now optionals and you start writing guards everywhere, confused about where to handle them gracefully and where to simply fatalError your way out. This is quite error prone and decreases readability drastically.

[…]

Writing layout code in Objective-C isn’t too bad, but with Swift it’s gotten a lot easier and most importantly, more readable. Declaring Auto Layout constraints is painless and beautiful, thanks to libraries like Cartography.

[…]

Storyboards are the future, according to Apple. Since Xcode 8.3, we don’t even get a checkbox to disable Storyboards when creating a project! 😅 Yet it’s quite heartbreaking that there’s no straightforward way to reuse a view you build on Interface Builder.

Previously: Eject from Interface Builder.

2 Comments RSS · Twitter

The issues with coding your UI from a language perspective are that:

- you have to adapt/rewrite the code if you move from Objective-C to Swift.
- you may have to update the code if you move from one version of Swift to another one.

Adam Maxwell

Remember when Windows n00bs would subscribe to macosx-dev or cocoa-dev and ask how to build an application without IB or even a MainMenu.nib? The community at large would laugh, then politely but firmly explain that IB was the correct way, the better way, and the faster way, when using Cocoa. Too bad all those Windows n00bs apparently went to work for Apple.

Leave a Comment