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:

  1. It’s easier to work with designers via storyboards
  2. They’re helpful for beginners learning to code in iOS
  3. They’re useful for visual learners
  4. They can reduce development time if one understands the possibilities and the limitations

Storyboards can suck because:

  1. No two developers can work on the same storyboard simultaneously without needing to resolve merge conflicts
  2. The tooling is not perfect; many things are either not intuitive, or limited
  3. For the most part, you can only change one view component at a time (mass changes can be applied to classes programmatically)
  4. 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. :)