title: swift 2 initializer for conditional binding must have Optional type, not 'UIImage'
body: <p>After updating my xcode to run swift 2 it gives me these two errors which i struggle to solve.</p>
  
  <blockquote>
    <p><strong>Error 1</strong> Cannot subscript a value of type '[String : AnyObject]?' with an index of type 'String'</p>
  </blockquote>
  
  <p><strong>Code</strong></p>
  
  <pre><code>let image : UIImage = editingInfo[UIImagePickerControllerOriginalImage] as! UIImage
  </code></pre>
  
  <blockquote>
    <p><strong>Error 2</strong> Initializer for conditional binding must have Optional type, not 'UIImage'</p>
  </blockquote>
  
  <p><strong>Code</strong></p>
  
  <pre><code>if let constImage = image  (Error2 display here) 
          {
              let targetWidth = UIScreen.mainScreen().scale * UIScreen.mainScreen().bounds.size.width
              let resizedImage = constImage.resize(targetWidth)
  
              picker.dismissViewControllerAnimated(true, completion: {
                  () -&gt; Void in
  
                  NetworkManager.sharedInstance.postImage(resizedImage, completionHandler: {
                      (error) -&gt; () in
  
                      if let constError = error
                      {
                          self.showAlert(constError.localizedDescription)
                      }
                  })
  
              })
          }
  </code></pre>