Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Dan Poynor
.a{fill-rule:evenodd;}techdegree seal-36
Dan Poynor
Data Analysis Techdegree Graduate 62,669 Points

Why code layouts instead of using interface builder?

Xcode now includes Interface Builder that enables creating layouts visually which previously required using code.

What are some situations we would still want to use the old way of creating layouts using code instead of using interface builder (specifically using xCode 9.4 )?

1 Answer

Each of them has pros and cons. I think some people prefer code over storyboards because merging a storyboard can be tricky. Moreover if you have a storyboard with lots of view controllers it will takes time to load for you to display. Code for some is also more readable and you can customize the views more easily. Code forces you to understand what's going on, which method will serve you to layout and add things

Interface builder on the other hand is really helpful to see what's going on, you can customize views, and have shorter class code.