Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Dan Poynor
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Dan Poynor
Data Analysis Techdegree Graduate 62,951 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.