react-native-vision-camera/ios/Parsers/AVCaptureDevice.Format.AutoFocusSystem+descriptor.swift
Marc Rousavy 9ea158ad8f
chore: Move to /mrousavy/ (#224)
* rename 1/n

* 2

* 3

* fix indent
2021-06-21 22:42:46 +02:00

41 lines
869 B
Swift

//
// AVCaptureDevice.Format.AutoFocusSystem+descriptor.swift
// mrousavy
//
// Created by Marc Rousavy on 29.12.20.
// Copyright © 2020 mrousavy. All rights reserved.
//
import AVFoundation
extension AVCaptureDevice.Format.AutoFocusSystem {
init(withString string: String) throws {
switch string {
case "contrast-detection":
self = .contrastDetection
return
case "phase-detection":
self = .phaseDetection
return
case "none":
self = .none
return
default:
throw EnumParserError.invalidValue
}
}
var descriptor: String {
switch self {
case .contrastDetection:
return "contrast-detection"
case .phaseDetection:
return "phase-detection"
case .none:
return "none"
@unknown default:
fatalError("AVCaptureDevice.Format has unknown state.")
}
}
}