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

jon kelson
jon kelson
5,149 Points

Structs and class in object swift

Hi all, in the set of videos object oriented swift . Just for arguments sake could the struct that Pasan made, be a class and the classes been struts ? I'm guessing he just made them different just to show us the difference . ?

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello Jon:

Just to answer your question.. Yes he could have.. But depending on your project you may want to know which one to use. IN a more general Idea, structs are the way to go, but keep in mind that classes are powerful because of their inheritance. One is a reference type (class), and the other one is value type (struct).

Good luck