What are 'get' and 'set' in Swift?
I'm learning Swift and I'm reading The Swift Programming Language from Apple, I have no Objective C background (only PHP, JS, and other but no Obj C) On page 24-25 I see this code: //...Class definition stuff... var perimeter: Double { get { return 3.0 * sideLength } set { sideLength = newValue / 3.0 } } //...Class continues... This part is NOT specified in the book and I can't get what those are for. Can anyone explain me what get and set are? That's actually explained right before the code: In addition to simple properties that are stored, properties can have a getter and a setter. class