Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New SPM product: UBQRScanner #13

Merged
merged 9 commits into from Feb 18, 2022
Merged

New SPM product: UBQRScanner #13

merged 9 commits into from Feb 18, 2022

Conversation

ubfelix
Copy link
Contributor

@ubfelix ubfelix commented Feb 11, 2022

This PR adds a new product UBQRScanner to the UBKit library. The core of this product is a class QRScannerView, a UIView subclass that provides functionality related to the scanning of QR codes and other supported formats. Internally, it uses an AVCaptureSession.

Successfully scanned codes (as Strings) and errors are received via the QRScannerViewDelegate methods.

@ubfelix ubfelix requested a review from a team February 11, 2022 14:43
@github-actions
Copy link

github-actions bot commented Feb 11, 2022

Unit Test Results

    1 files  ±0      3 suites  ±0   2m 8s ⏱️ ±0s
163 tests ±0  163 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 219093f. ± Comparison against base commit 219093f.

♻️ This comment has been updated with latest results.

@ubfelix ubfelix changed the title UBQRScanner New SPM product: UBQRScanner Feb 11, 2022
/// the successful scanning of a code or specific errors are received via the `QRScannerViewDelegate` methods.
/// - Important: Apps using this view must provide a value for `NSCameraUsageDescription` in their `Info.plist`,
/// else the app will crash as soon as the `startScanning()` method is called.
public class QRScannerView: UIView {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not open?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should be necessary to subclass this. There is no UI except for the camera view, and if we want to change something in this class, I think it's better to think about changing it in the module itself than creating a subclass.

}
NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: nil) { [weak self] _ in
guard let self = self else { return }
if let lastIsRunning = self.lastIsRunning, lastIsRunning == true {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good candidate for a guard structure

Sources/UBQRScanner/QRScannerView.swift Outdated Show resolved Hide resolved
Sources/UBQRScanner/QRScannerView.swift Outdated Show resolved Hide resolved
Sources/UBQRScanner/QRScannerView.swift Show resolved Hide resolved
Sources/UBQRScanner/QRScannerView.swift Show resolved Hide resolved
Sources/UBQRScanner/QRScannerView.swift Show resolved Hide resolved
@ubfelix ubfelix merged commit 219093f into main Feb 18, 2022
@ubfelix ubfelix deleted the feature/qr-scanner-view branch February 18, 2022 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants