title: How to add input device for capturesession in Swift2 and Xcode7 beta?
body: <p>I am following this tutorial to make a camera app, but the tutorial is in Swift and I am using Xcode 7 beta and Swift2.</p>
  
  <p><a href="http://jamesonquave.com/blog/taking-control-of-the-iphone-camera-in-ios-8-with-swift-part-1/" rel="nofollow">http://jamesonquave.com/blog/taking-control-of-the-iphone-camera-in-ios-8-with-swift-part-1/</a></p>
  
  <p>I heard that Swift2 has a different error-handling method now, so I guess this part of code needs to be changed. But I am not sure how. Can anyone help me with this? Thanks!</p>
  
  <pre><code>var err : NSError? = nil
          captureSession.addInput(AVCaptureDeviceInput(device: captureDevice, error: &amp;err))
  
          if err != nil {
              println("error: \(err?.localizedDescription)")
          }
  </code></pre>