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.

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
MOD
Michael Hulet
Treehouse Moderator 47,830 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