Challenge: Properties | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5429279-programming-in-swift-functions-and-types/lessons/32

Thanks for the awesome videos!!!

It seems weird to have a setter on a computed property. Why would we want to add a setter to a computed property in general? couldn’t we left the degreesC as read-only with only get?

Hi! Thanks for your question. In this exercise, yes, you could just leave one of the properties as read-only. Sometimes you’ll run into cases where you have properties that represent the same data, or their data needs to be linked in some way, and it’s necessary (or even just convenient) to be able to set them both ways. There are different ways to go about solving hypothetical problems like that, but having a setter like this is a lightweight solution that’s handy to know.