TIL: My Philosophy on developing views in Storyboards vs Programmatically
The age old debate… where does the storyboard end and the programming begin?
Many developers have very strong negative opinions of storyboards. I’m not going to say that they’re wonderful, but I do think they’re useful, and I do think that they get a bad wrap.
Storyboards are useful because:
- It’s easier to work with designers via storyboards
- They’re helpful for beginners learning to code in iOS
- They’re useful for visual learners
- They can reduce development time if one understands the possibilities and the limitations
Storyboards can suck because:
- No two developers can work on the same storyboard simultaneously without needing to resolve merge conflicts
- The tooling is not perfect; many things are either not intuitive, or limited
- For the most part, you can only change one view component at a time (mass changes can be applied to classes programmatically)
- Storyboard specifications can be overwritten programmatically which can lead to confusion and/or gray area…
My philosophy as this:
- Everything that can be done in storyboards (within reason), should be done in storyboards.
- Everything that’s leftover should then be moved to the code. For example, setting content dynamically, and animations must be done programatically.
But, the absolute most important aspect of determining what to do in the storyboard vs what to do programmatically is to be consistent across your development team. Have the conversation your fellow iOS developers, make an internal decision, and come to consensus. :)