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 Simple iPhone App with Swift 2.0 Structs as Data Models Recap: Data Models

Why do we not use an initializer method when creating the model in our app?

Any one who can explain it? Also, do you think it is OK not to memorize how to write the chaining of methods etc

1 Answer

Nathan Tallack
Nathan Tallack
22,159 Points

One thing that is wonderful about Struct objects is the default initializers that come with it. Unless you have the need to initialize computed properties or do other such complex things you can just allow the struct to initialize all of your properties for you.

This makes for very simple and clean code, as you just saw with our FactModel and ColorModel in this project.