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

Swift

Where is the code?

Hello all,

I am working on the beginner swift class, auto layout videos. Pasan is working through the auto layout. I am curious though. When you are using the auto layout, where is the code being written. Where can I view the corresponding code, so that I can review it, and better understand the process as a whole?

2 Answers

Michael Hulet
Michael Hulet
47,913 Points

In effect, when you use Interface Builder (i.e. storyboards, .xibs, and .nibs) to build your layouts (including with AutoLayout), there really isn't any code. What you're seeing graphically effectively is the code. It's encoded into plain text in an XML-like syntax that you can see if you'd like by right-clicking the Interface Builder file you're working on and selecting "Open As > Source Code" in the menu that pops up, but no iOS developer actually works with that code directly. If you'd like to work with AutoLayout in code yourself, though, you should totally watch the workshop on Programmatic Auto Layout to learn more

Thank you!! That is exactly what I was looking for!

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

Each video has a 'Downloads' tab beneath it. Most of the time, there will be a 'Project Files' download with the current state of the project for that video in it.

Download tab for video