title: Double question mark, How does it work?
body: <p>I am learning Swift and, as part of the process, trying to figure out what exactly is going on here. I have a custom segue where I want to place my modal view controller dismissing transition. What used to be in objective-c as:</p>
  
  <pre><code>UIViewController *sourceViewController = self.sourceViewController;
  [sourceViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
  </code></pre>
  
  <p><code>self</code> is an instance of <code>UIStoryboardSegue</code>.
  I translated this snippet in Swift as:</p>
  
  <pre><code>self.sourceViewController.presentingViewController?.dismissViewControllerAnimated(true, completion: nil)
  </code></pre>
  
  <p>getting this error from the compiler:</p>
  
  <blockquote>
    <p>'UIViewController?' does not have a member named
    'dismissViewControllerAnimated'</p>
  </blockquote>
  
  <p>Now, <a href="https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/index.html#//apple_ref/occ/instp/UIViewController/presentingViewController">by documentation</a>, the <code>presentingViewController</code> method looks like this:</p>
  
  <pre><code>var presentingViewController: UIViewController? { get }
  </code></pre>
  
  <p>From what I understood by the Swift language documentation, <code>?</code> should unwrap the value, if any. In this case the view controller. The unexplained fact is: if I put a double question mark, it compiles and it works:</p>
  
  <pre><code>self.sourceViewController.presentingViewController??.dismissViewControllerAnimated(true, completion: nil)
  </code></pre>
  
  <p>Can someone tell me what I am missing? What should that do?</p>