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 Build a Vending Machine App in Swift 2.0 Modeling An Interface Laying the Groundwork

Handy Metellus
Handy Metellus
7,796 Points

Swift best practice multiple files

In regards to swift, is it best practice to have classes, structs etc in multiple files for readability, or is it ok to have them all in one file?

Thanks

Paul Karim
Paul Karim
3,428 Points

Definitely do NOT want them all in one file, what he meant in this video on its okay to have them all in one file was you can have multiple protocols and classes in one file for readability if all the objects pertain to a single thing. In this case creation of a vending machine.