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.

iOS

Calvin Liem
Calvin Liem
3,599 Points

understanding large Project

hi team

this is my first month with teamtreehouse

when we want to build a big project, what is the easy way to build that i watch the OOP in swift and so i understand a little bit about code

but something is not clear in my head like

should we make 1 swift file containing all the object(class) and then use it in another swift controller file that control user view?

or

make 1 swift file for 1 object then use it in another swift controller file?

or

make 1 controller swift file for 1 view (write object in there when needed and use it inside the file)

thanks i hope my question is clear

1 Answer

Hi Calvin,

This is a awesome question. You never want to put all your classes in one file. Doing so it make it hard to scale the project later on. Each class should have its own file.

Check out this course: https://teamtreehouse.com/library/objectoriented-swift

Note: One of the things I do when building a new project is focus on the design. Design will always have an huge impact on the code we write. After the design is complete, I break things down into objects and functions. From there I start building my classes.

I hope that helps :)