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

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 :)