title: What is an "unwrapped value" in Swift?
body: <p>I'm learning Swift for iOS 8 / OSX 10.10 by following <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2" rel="noreferrer">this tutorial</a>, and the term &quot;<strong>unwrapped value</strong>&quot; is used several times, as in this paragraph (under <em>Objects and Class</em>):</p>
  <blockquote>
  <p>When working with optional values, you can write ? before operations
  like methods, properties, and subscripting. If the value before the ?
  is nil, everything after the ? is ignored and the value of the whole
  expression is nil. Otherwise, <strong>the optional value is unwrapped</strong>, and
  everything after the ? acts on the <strong>unwrapped value</strong>. In both cases, the
  value of the whole expression is an optional value.</p>
  </blockquote>
  <pre><code>let optionalSquare: Square? = Square(sideLength: 2.5, name: &quot;optional square&quot;) 
  let sideLength = optionalSquare?.sideLength
  </code></pre>
  <p>I don't get it, and searched on the web without luck.</p>
  <p>What does this means?</p>
  <hr />
  <h2>Edit</h2>
  <p>From Cezary's answer, there's a slight difference between the output of the original code and the final solution (tested on playground) :</p>
  <h3>Original code</h3>
  <p><img src="https://i.stack.imgur.com/Ns3my.png" alt="Original code" /></p>
  <h3>Cezary's solution</h3>
  <p><img src="https://i.stack.imgur.com/RsvFp.png" alt="Cezary's solution" /></p>
  <p>The superclass' properties are shown in the output in the second case, while there's an empty object in the first case.</p>
  <p>Isn't the result supposed to be identical in both case?</p>
  <p><strong>Related Q&amp;A : <a href="https://stackoverflow.com/a/24026093/1437016">What is an optional value in Swift?</a></strong></p>