How to use get and set in Swift
<p>I have a block of simple code calculating the area &amp; perimeter of a rhombus.</p>

<pre><code> var perimeterOfRhombus: Double {
        get {
            let twoSides1 = sideLength1 + sideLength1
            let twoSides2 = sideLength2 + sideLength2
            let finalPerimeter = twoSides1 + twoSides2
            return finalPerimeter
        } set {
      }
    }
</code></pre>

<p>What I am missing is the set section. </p>

<p>I want it to show what sideLength1 and sideLength2 were in the beginning.</p>

<p>I am not sure what newValue is used for, when it has no value.</p>

<p>It does work without using set, but I see on Apple's <code>swift</code> language guide that set and get usually go together. </p>

<p>If set is really not needed in this code, what is it normally used for anyways?</p>