I\'m writing an iOS app, and I need to be able to detect if the device has a camera. Previously, I would check if the device is an iPhone or not, since only the iPhone has a
You can check for availability of a specific source type using discovery session (Swift 5):
let discovery = AVCaptureDevice.DiscoverySession.init(deviceTypes: [.builtInWideAngleCamera], mediaType: AVMediaType.video, position: .back) let isWideAngleCameraSupported = !discovery.devices.isEmpty