Skip to content

Commit

Permalink
Merge pull request #149 from tataruRobert/my-feature-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanfallet authored Dec 1, 2024
2 parents 9fa582f + d89df51 commit 746c1c1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Sources/CodeScanner/ScannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,17 +513,22 @@ extension CodeScannerView.ScannerViewController: UIImagePickerControllerDelegate

let features = detector.features(in: ciImage)

for feature in features as! [CIQRCodeFeature] {
qrCodeLink = feature.messageString!
if qrCodeLink.isEmpty {
didFail(reason: .badOutput)
} else {
if features.isEmpty {
didFail(reason: .badOutput)
} else {
for feature in features.compactMap({ $0 as? CIQRCodeFeature }) {
guard let qrCodeLink = feature.messageString, !qrCodeLink.isEmpty else {
didFail(reason: .badOutput)
continue
}

let corners = [
feature.bottomLeft,
feature.bottomRight,
feature.topRight,
feature.topLeft
]

let result = ScanResult(string: qrCodeLink, type: .qr, image: qrcodeImg, corners: corners)
found(result)
}
Expand Down

0 comments on commit 746c1c1

Please sign in to comment.