Skip to content

Instantly share code, notes, and snippets.

@EricShapiro
Last active February 2, 2019 16:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricShapiro/da69cea54da39a9429fe3616ceca78d8 to your computer and use it in GitHub Desktop.
Save EricShapiro/da69cea54da39a9429fe3616ceca78d8 to your computer and use it in GitHub Desktop.
Reasons to create UI in code rather than storyboard
Reasons to create UIs in code rather than Storyboards:
Merge conflicts
Easier to diff revisions and see changes in code
More flexibility to move UI elements on iPad vs iPhone,
portrait vs landscape
Easier theme support
Easier to animate views
Easier to hide/show views
Faster layout at runtime
Interface Builder is a hassle when deleting or moving views
with autolayout, often requiring us to delete and recreate a
bunch of constraints.
Easier to share a source file between projects than a source
file and piece of a storyboard or even a xib
We can write custom view code that runs on Macs and iOS if
we're careful, which is very hard to do with Interface
Builder.
Storyboards have magic values in them that have to match
magic values in code, for example segue identifiers. It's
very easy for typos to result in runtime misfires.
Having said all of that, we do prototype in storyboards at
times and they're certainly useful for simple apps.
@bobleesj
Copy link

I agree with you my friend. Typos that cause NSException.

"Having said all of that, we do prototype in storyboards at
times and they're certainly useful for simple apps." - I agree with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment