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 Intermediate Swift 2 Properties Computed Properties

Ryan Maneo
Ryan Maneo
4,342 Points

WHAT?!

Gonna be blunt. What the? This contains a TON of omitted knowledge...

  1. He never mentioned you can use set or get as a computed value, it appeared as if you had to use a constant...

  2. What does "set(centerValue) { }" mean... like... what??? I know we can bind local constants to associated values.. but apparently we can in this case too? Why was there no pre explanation for this...

  3. class properties weren't discussed enough to be put into full force... he should review everything we went over previously... just look at the other questions for this video-we've gone from 0 to 100 in two videos, we're lost, please elaborate.

1 Answer

What do you mean by your first question? He clearly explained that computed values can have setters and getters, which we have discussed previously.

set(centerValue) {}, as he clearly described, allows you to provide implementation for a setter for the computed value. It takes in a point (centerValue), and computes out the Rectangle's new origin and size.

Class properties were explained pretty extensively by Pasan, and there was nothing prohibiting you from asking questions about those or rewatching the videos.

I feel like you're being far too harsh on the teachers and should just either rewatch or ask questions about what you are confused on, rather than just screaming "OMITTED KNOWLEDGE!" on every single lesson.