update ci.yml for Xcode 14.1 (#37)
A simple QR Code scanner framework for iOS. Provides a similar scan effect to ios13+. Written in Swift.
“QR Code” is a registered trademark of DENSO WAVE INCORPORATED
QRScanner supports multiple methods for installing the library in a project.
To integrate QRScanner into your Xcode project using CocoaPods, specify it in your Podfile
Podfile
platform :ios, '11.0' pod 'MercariQRScanner'
Run command
pod install
Write Import statement on your source file
import MercariQRScanner
Once you have your Swift package set up, adding QRScanner as a dependency is as easy as adding it to the dependencies value of your Package.swift.
Package.swift
dependencies: [ .package(url: "https://github.com/mercari/QRScanner.git", .upToNextMajor(from: "1.9.0")) ]
import QRScanner
Cartfile
github "mercari/QRScanner"
See QRScannerSample
Privacy - Camera Usage Description
import QRScanner // If use the Pod way, please import MercariQRScanner import AVFoundation final class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() setupQRScanner() } private func setupQRScanner() { switch AVCaptureDevice.authorizationStatus(for: .video) { case .authorized: setupQRScannerView() case .notDetermined: AVCaptureDevice.requestAccess(for: .video) { [weak self] granted in if granted { DispatchQueue.main.async { [weak self] in self?.setupQRScannerView() } } } default: showAlert() } } private func setupQRScannerView() { let qrScannerView = QRScannerView(frame: view.bounds) view.addSubview(qrScannerView) qrScannerView.configure(delegate: self, input: .init(isBlurEffectEnabled: true)) qrScannerView.startRunning() } private func showAlert() { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in let alert = UIAlertController(title: "Error", message: "Camera is required to use in this application", preferredStyle: .alert) alert.addAction(.init(title: "OK", style: .default)) self?.present(alert, animated: true) } } } extension ViewController: QRScannerViewDelegate { func qrScannerView(_ qrScannerView: QRScannerView, didFailure error: QRScannerError) { print(error) } func qrScannerView(_ qrScannerView: QRScannerView, didSuccess code: String) { print(code) } }
override func viewDidLoad() { super.viewDidLoad() let qrScannerView = QRScannerView(frame: view.bounds) // Customize focusImage, focusImagePadding, animationDuration qrScannerView.focusImage = UIImage(named: "scan_qr_focus") qrScannerView.focusImagePadding = 8.0 qrScannerView.animationDuration = 0.5 qrScannerView.configure(delegate: self) view.addSubview(qrScannerView) qrScannerView.startRunning() }
FlashButtonSample
final class ViewController: UIViewController { ... @IBOutlet var flashButton: FlashButton! @IBAction func tapFlashButton(_ sender: UIButton) { qrScannerView.setTorchActive(isOn: !sender.isSelected) } } extension ViewController: QRScannerViewDelegate { ... func qrScannerView(_ qrScannerView: QRScannerView, didChangeTorchActive isOn: Bool) { flashButton.isSelected = isOn } }
qrScannerView.configure(delegate: self, input: .init(isBlurEffectEnabled: true))
Please read the CLA carefully before submitting your contribution to Mercari. Under any circumstances, by submitting your contribution, you are deemed to accept and agree to be bound by the terms and conditions of the CLA.
https://www.mercari.com/cla/
Copyright 2019 Mercari, Inc.
Licensed under the MIT License.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
QRScanner
A simple QR Code scanner framework for iOS. Provides a similar scan effect to ios13+. Written in Swift.
“QR Code” is a registered trademark of DENSO WAVE INCORPORATED
Feature
Development Requirements
Installation
QRScanner supports multiple methods for installing the library in a project.
Installation with CocoaPods
To integrate QRScanner into your Xcode project using CocoaPods, specify it in your
Podfile
Run command
Write Import statement on your source file
Installation with Swift Package Manager
Once you have your Swift package set up, adding QRScanner as a dependency is as easy as adding it to the dependencies value of your
Package.swift
.Installation with Carthage
Cartfile
.Usage
See QRScannerSample
Add
Privacy - Camera Usage Description
to Info.plist fileThe Basis Of Usage
Customization
Source Code Way
Interface Builder Way
Add FlashButton
FlashButtonSample
Add Blur Effect
Source Code Way
Interface Builder Way
Committers
Contribution
Please read the CLA carefully before submitting your contribution to Mercari. Under any circumstances, by submitting your contribution, you are deemed to accept and agree to be bound by the terms and conditions of the CLA.
https://www.mercari.com/cla/
License
Copyright 2019 Mercari, Inc.
Licensed under the MIT License.