title: How to detect if photo taken from front camera
body: <p>I want to change orientation of photo taken from front camera vertically with following code :</p>
  
  <pre><code>let reversedImage = UIImage(CGImage: image.CGImage!, scale: 1.0, orientation: .LeftMirrored)
  </code></pre>
  
  <p>But, how can I detect if photo taken from front camera ? I tried following code but it didn't work :</p>
  
  <pre><code>     let availableCameraDevices = AVCaptureDevice.devicesWithMediaType(AVMediaTypeVideo)
                  for device in availableCameraDevices as! [AVCaptureDevice] {
                      if device.position == .Back {
                          let reversedImage = UIImage(CGImage: image.CGImage!, scale: 1.0, orientation: .LeftMirrored)
  
                          sp.pickedPhoto = reversedImage
  
                      }
                      else if device.position == .Front {
                          sp.pickedPhoto = image
  
  
                      }
                  }
  </code></pre>