oc
if (@available(iOS 13.0, *)) {
AVCaptureDeviceDiscoverySession *ultraWideSession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInUltraWideCamera] mediaType:AVMediaTypeVideo position:position];
if (ultraWideSession.devices.count > 0) {
deviceType = AVCaptureDeviceTypeBuiltInUltraWideCamera;
}
}
swift
let deviceType: AVCaptureDevice.DeviceType = {
if #available(iOS 13.0, *) {
return .builtInUltraWideCamera
} else {
return .builtInWideAngleCamera
}
}()