Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ios/ReactNativeCameraKit/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
private var supportedBarcodeType: [CodeFormat] = {
return CodeFormat.allCases
}()

Check warning on line 27 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Lines should not have trailing whitespace (trailing_whitespace)
// camera
private var ratioOverlayView: RatioOverlayView?

Expand Down Expand Up @@ -62,8 +62,8 @@

@objc public var onCaptureButtonPressIn: RCTDirectEventBlock?
@objc public var onCaptureButtonPressOut: RCTDirectEventBlock?

Check warning on line 65 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Lines should not have trailing whitespace (trailing_whitespace)
var eventInteraction: Any? = nil

Check warning on line 66 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Initializing an optional variable with nil is redundant (redundant_optional_initialization)

// MARK: - Setup

Expand Down Expand Up @@ -126,20 +126,20 @@
focusInterfaceView.delegate = camera

handleCameraPermission()

Check warning on line 129 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Lines should not have trailing whitespace (trailing_whitespace)
configureHardwareInteraction()
}

Check warning on line 132 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Lines should not have trailing whitespace (trailing_whitespace)
private func configureHardwareInteraction() {
#if !targetEnvironment(macCatalyst)
// Create a new capture event interaction with a handler that captures a photo.
if #available(iOS 17.2, *) {
let interaction = AVCaptureEventInteraction { event in
let interaction = AVCaptureEventInteraction { [weak self] event in
// Capture a photo on "press up" of a hardware button.
if event.phase == .began {
self.onCaptureButtonPressIn?(nil)
self?.onCaptureButtonPressIn?(nil)
} else if event.phase == .ended {
self.onCaptureButtonPressOut?(nil)
self?.onCaptureButtonPressOut?(nil)
}
}
// Add the interaction to the view controller's view.
Expand All @@ -161,7 +161,7 @@
super.reactSetFrame(frame)
self.updateSubviewsBounds(frame)
}

Check warning on line 164 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Lines should not have trailing whitespace (trailing_whitespace)
@objc public func updateSubviewsBounds(_ frame: CGRect) {
camera.previewView.frame = bounds

Expand Down Expand Up @@ -411,7 +411,7 @@
return temporaryFileURL
}

private func onBarcodeRead(barcode: String, codeFormat:CodeFormat) {

Check warning on line 414 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Colons should be next to the identifier when specifying a type and next to the key in dictionary literals (colon)
// Throttle barcode detection
let now = Date.timeIntervalSinceReferenceDate
guard lastBarcodeDetectedTime + Double(scanThrottleDelay) / 1000 < now else {
Expand All @@ -420,7 +420,7 @@

lastBarcodeDetectedTime = now

onReadCode?(["codeStringValue": barcode,"codeFormat":codeFormat.rawValue])

Check warning on line 423 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

There should be no space before and one after any comma (comma)

Check warning on line 423 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

Colons should be next to the identifier when specifying a type and next to the key in dictionary literals (colon)
}

// MARK: - Gesture selectors
Expand All @@ -433,4 +433,4 @@
camera.zoomPinchChange(pinchScale: pinchRecognizer.scale)
}
}
}

Check warning on line 436 in ios/ReactNativeCameraKit/CameraView.swift

View workflow job for this annotation

GitHub Actions / Lint iOS

File should contain 400 lines or less: currently contains 436 (file_length)
Loading