A case for programmatic views in iOS

Context

If you're new to ios, building ui in xcode, and frustrated with inability to search for help effectively.

Suggestion

Layout your ui programmatically. I've found PureLayout helpful for this.

Benefits

  1. Search based on concrete syntax (as opposed to search for the button that looks like … in xcode version …)
  2. Reference other people's ui, eg PureLayout's demos, without having to load it in xcode
  3. Comment on configuration (credit to Yong for noticing this)
  4. Code-review changes
  5. Reduce cognitive load because you only have to understand autolayout, not autolayout + interface builder

Caveat

Interface builder does a lot (I recently learned from Riz that LaunchKit used compiled storyboards for dynamic ui!), and is Apple's recommended approach. I suspect I'll have a better experience with it once I have more ui experience.

Feedback

Thoughts? Suggestions? Hit me up @erikeldridge

License

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 International License, and code samples are licensed under the MIT license.