chore: Lint

This commit is contained in:
Marc Rousavy 2021-12-10 09:44:54 +01:00
parent c3039c94c6
commit 9301430165
6 changed files with 22 additions and 22 deletions

View File

@ -38,7 +38,7 @@ extension CameraView {
// Audio Input
do {
if let audioDeviceInput = self.audioDeviceInput {
if let audioDeviceInput = audioDeviceInput {
audioCaptureSession.removeInput(audioDeviceInput)
self.audioDeviceInput = nil
}
@ -61,7 +61,7 @@ extension CameraView {
}
// Audio Output
if let audioOutput = self.audioOutput {
if let audioOutput = audioOutput {
audioCaptureSession.removeOutput(audioOutput)
self.audioOutput = nil
}

View File

@ -40,7 +40,7 @@ extension CameraView {
}
// If preset is set, use preset. Otherwise use format.
if let preset = self.preset {
if let preset = preset {
var sessionPreset: AVCaptureSession.Preset?
do {
sessionPreset = try AVCaptureSession.Preset(withString: preset)
@ -64,7 +64,7 @@ extension CameraView {
// pragma MARK: Capture Session Inputs
// Video Input
do {
if let videoDeviceInput = self.videoDeviceInput {
if let videoDeviceInput = videoDeviceInput {
captureSession.removeInput(videoDeviceInput)
self.videoDeviceInput = nil
}
@ -87,7 +87,7 @@ extension CameraView {
// pragma MARK: Capture Session Outputs
// Photo Output
if let photoOutput = self.photoOutput {
if let photoOutput = photoOutput {
captureSession.removeOutput(photoOutput)
self.photoOutput = nil
}
@ -121,7 +121,7 @@ extension CameraView {
}
// Video Output + Frame Processor
if let videoOutput = self.videoOutput {
if let videoOutput = videoOutput {
captureSession.removeOutput(videoOutput)
self.videoOutput = nil
}
@ -159,7 +159,7 @@ extension CameraView {
do {
try device.lockForConfiguration()
if let fps = self.fps?.int32Value {
if let fps = fps?.int32Value {
let supportsGivenFps = device.activeFormat.videoSupportedFrameRateRanges.contains { range in
return range.includes(fps: Double(fps))
}
@ -195,7 +195,7 @@ extension CameraView {
device.automaticallyEnablesLowLightBoostWhenAvailable = lowLightBoost!.boolValue
}
}
if let colorSpace = self.colorSpace as String? {
if let colorSpace = colorSpace as String? {
guard let avColorSpace = try? AVCaptureColorSpace(string: colorSpace),
device.activeFormat.supportedColorSpaces.contains(avColorSpace) else {
invokeOnError(.format(.invalidColorSpace(colorSpace: colorSpace)))
@ -219,7 +219,7 @@ extension CameraView {
*/
final func configureFormat() {
ReactLogger.log(level: .info, message: "Configuring Format...")
guard let filter = self.format else {
guard let filter = format else {
// Format Filter was null. Ignore it.
return
}

View File

@ -45,7 +45,7 @@ extension CameraView {
}
func removePinchGestureRecognizer() {
if let pinchGestureRecognizer = self.pinchGestureRecognizer {
if let pinchGestureRecognizer = pinchGestureRecognizer {
removeGestureRecognizer(pinchGestureRecognizer)
self.pinchGestureRecognizer = nil
}

View File

@ -342,7 +342,7 @@ public final class CameraView: UIView {
// pragma MARK: Event Invokers
internal final func invokeOnError(_ error: CameraError, cause: NSError? = nil) {
ReactLogger.log(level: .error, message: "Invoking onError(): \(error.message)")
guard let onError = self.onError else { return }
guard let onError = onError else { return }
var causeDictionary: [String: Any]?
if let cause = cause {
@ -362,13 +362,13 @@ public final class CameraView: UIView {
internal final func invokeOnInitialized() {
ReactLogger.log(level: .info, message: "Camera initialized!")
guard let onInitialized = self.onInitialized else { return }
guard let onInitialized = onInitialized else { return }
onInitialized([String: Any]())
}
internal final func invokeOnFrameProcessorPerformanceSuggestionAvailable(currentFps: Double, suggestedFps: Double) {
ReactLogger.log(level: .info, message: "Frame Processor Performance Suggestion available!")
guard let onFrameProcessorPerformanceSuggestionAvailable = self.onFrameProcessorPerformanceSuggestionAvailable else { return }
guard let onFrameProcessorPerformanceSuggestionAvailable = onFrameProcessorPerformanceSuggestionAvailable else { return }
if lastSuggestedFrameProcessorFps == suggestedFps { return }
if suggestedFps == currentFps { return }

View File

@ -42,7 +42,7 @@ extension AVCaptureDevice.Format {
"maxFrameRate": $0.maxFrameRate,
]
},
"pixelFormat": CMFormatDescriptionGetMediaSubType(formatDescription).toString()
"pixelFormat": CMFormatDescriptionGetMediaSubType(formatDescription).toString(),
]
if #available(iOS 13.0, *) {

View File

@ -7,11 +7,11 @@
//
extension FourCharCode {
func toString() -> String {
var s: String = String (UnicodeScalar((self >> 24) & 255)!)
s.append(String(UnicodeScalar((self >> 16) & 255)!))
s.append(String(UnicodeScalar((self >> 8) & 255)!))
s.append(String(UnicodeScalar(self & 255)!))
return (s)
}
func toString() -> String {
var s = String(UnicodeScalar((self >> 24) & 255)!)
s.append(String(UnicodeScalar((self >> 16) & 255)!))
s.append(String(UnicodeScalar((self >> 8) & 255)!))
s.append(String(UnicodeScalar(self & 255)!))
return (s)
}
}