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!

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

Ryan Maneo
Ryan Maneo
4,342 Points


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.