I'm writing a photo app and I need different overlays in the camera view for iPhones with dual camera (to account for the zoom ui), is there a proper way to check if a dual camera exists?
I tried to get the device and check if it was nil for the non dual camera iPhones, tho it still retunes a device:
let device = AVCaptureDevice.defaultDevice(withDeviceType: .builtInDualCamera, mediaType: AVMediaTypeVideo, position: .back)
Dose anyone know how to detect the dual camera?
Swift 5:
var currentDevice:AVCaptureDevice?
if let device = AVCaptureDevice.default(.builtInDualCamera, for: AVMediaType.video, position: .back) {
currentDevice = device
} else if let device = AVCaptureDevice.default(.builtInWideAngleCamera, for: AVMediaType.video, position: .back) {
currentDevice = device
} else {
print("Error: no camera available")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With