From 93014301659b49f3aae186f924e406c4ab372a59 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Fri, 10 Dec 2021 09:44:54 +0100 Subject: [PATCH] chore: Lint --- ios/CameraView+AVAudioSession.swift | 4 ++-- ios/CameraView+AVCaptureSession.swift | 14 +++++++------- ios/CameraView+Zoom.swift | 2 +- ios/CameraView.swift | 6 +++--- .../AVCaptureDevice.Format+toDictionary.swift | 4 ++-- ios/Extensions/FourCharCode+toString.swift | 14 +++++++------- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ios/CameraView+AVAudioSession.swift b/ios/CameraView+AVAudioSession.swift index 46b80e7..0b1fbdb 100644 --- a/ios/CameraView+AVAudioSession.swift +++ b/ios/CameraView+AVAudioSession.swift @@ -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 } diff --git a/ios/CameraView+AVCaptureSession.swift b/ios/CameraView+AVCaptureSession.swift index a99350f..5c9b77d 100644 --- a/ios/CameraView+AVCaptureSession.swift +++ b/ios/CameraView+AVCaptureSession.swift @@ -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 } diff --git a/ios/CameraView+Zoom.swift b/ios/CameraView+Zoom.swift index 90380a1..08df6cc 100644 --- a/ios/CameraView+Zoom.swift +++ b/ios/CameraView+Zoom.swift @@ -45,7 +45,7 @@ extension CameraView { } func removePinchGestureRecognizer() { - if let pinchGestureRecognizer = self.pinchGestureRecognizer { + if let pinchGestureRecognizer = pinchGestureRecognizer { removeGestureRecognizer(pinchGestureRecognizer) self.pinchGestureRecognizer = nil } diff --git a/ios/CameraView.swift b/ios/CameraView.swift index ad4a931..53c3763 100644 --- a/ios/CameraView.swift +++ b/ios/CameraView.swift @@ -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 } diff --git a/ios/Extensions/AVCaptureDevice.Format+toDictionary.swift b/ios/Extensions/AVCaptureDevice.Format+toDictionary.swift index f256520..fec83ca 100644 --- a/ios/Extensions/AVCaptureDevice.Format+toDictionary.swift +++ b/ios/Extensions/AVCaptureDevice.Format+toDictionary.swift @@ -42,13 +42,13 @@ extension AVCaptureDevice.Format { "maxFrameRate": $0.maxFrameRate, ] }, - "pixelFormat": CMFormatDescriptionGetMediaSubType(formatDescription).toString() + "pixelFormat": CMFormatDescriptionGetMediaSubType(formatDescription).toString(), ] if #available(iOS 13.0, *) { dict["isHighestPhotoQualitySupported"] = self.isHighestPhotoQualitySupported } - + return dict } } diff --git a/ios/Extensions/FourCharCode+toString.swift b/ios/Extensions/FourCharCode+toString.swift index fcb4d77..f841e90 100644 --- a/ios/Extensions/FourCharCode+toString.swift +++ b/ios/Extensions/FourCharCode+toString.swift @@ -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) + } }