title: Evaluate Bool property of optional object in if statement
body: <p>I am looking for a way to evaluate a Swift <code>Bool</code> concisely in a single <code>if</code> statement, when the <code>Bool</code> is the property of an optional object:</p>
  
  <pre><code>var objectWithBool: ClassWithBool?
  // ...
  
  if let obj = objectWithBool {
      if obj.bool {
          // bool == true
      } else {
          // bool == false
      }
  } else {
      // objectWithBool == nil
  }
  </code></pre>
  
  <p>Is there are way to combine these <code>if</code> statements? In Objective-C this could easily be done, as a <code>nil</code> object can be evaluated in the same expression:</p>
  
  <pre><code>if (objectWithBool.bool) {
      // bool == true
  } else {
      // bool == false || objectWithBool == nil
  }
  </code></pre>