Last active
February 2, 2019 16:44
-
-
Save EricShapiro/da69cea54da39a9429fe3616ceca78d8 to your computer and use it in GitHub Desktop.
Reasons to create UI in code rather than storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.