How to check if iPhone has a dual camera?

I am writing a photo application and I need different camera overlays for the iPhone with a dual camera (to account for the increase in ui), is there a suitable way to check if a dual camera exists?

I tried to get the device and check if it was zero for non-dual cameras, but it still reconfigures the device:

let device = AVCaptureDevice.defaultDevice(withDeviceType: .builtInDualCamera, mediaType: AVMediaTypeVideo, position: .back) 

Does anyone know how to detect a dual camera?

+5
source share
1 answer

As an example of an apple:

 if let device = AVCaptureDevice.defaultDevice(withDeviceType: .builtInDuoCamera, mediaType: AVMediaTypeVideo, position: .back) { return device } else if let device = AVCaptureDevice.defaultDevice(withDeviceType: .builtInWideAngleCamera, mediaType: AVMediaTypeVideo, position: .back) { return device } else { return nil } 
0
source

Source: https://habr.com/ru/post/1269407/


All Articles