I want to change orientation of photo taken from front camera vertically with following code :
let reversedImage = UIImage(CGImage: image.CGImage!, scale: 1.0, orientation: .LeftMirrored)
But, how can I detect if photo taken from front camera ? I tried following code but it didn't work :
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
}
}