title: Accessing front Camera with swift?
body: <p>I've done some searching and most answers are either in Obj-C or not applicable to this code.</p>
  
  <p>I'm using this guide : <a href="http://drivecurrent.com/devops/using-swift-and-avfoundation-to-create-a-custom-camera-view-for-an-ios-app/" rel="nofollow">http://drivecurrent.com/devops/using-swift-and-avfoundation-to-create-a-custom-camera-view-for-an-ios-app/</a></p>
  
  <p>and I've got this code from it: </p>
  
  <pre><code>     super.viewWillAppear(animated)
  
      captureSession = AVCaptureSession()
      captureSession!.sessionPreset = AVCaptureSessionPresetPhoto
  
      let backCamera = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo)
      let frontCamera = ????
  
      var error: NSError?
      var input: AVCaptureDeviceInput!
      do {
          input = try AVCaptureDeviceInput(device: backCamera)
      } catch let error1 as NSError {
          error = error1
          input = nil
      }
  </code></pre>
  
  <p>The back camera is the default but I'm not seeing how to straight up access the front camera in order to let people swap back and forth.</p>