QRCodeScannerFramework 1.0.2

QRCodeScannerFramework 1.0.2

Hussein Kishk维护。



  • Hussein Kishk

QRCodeScannerFramework

使用AVFoundation在iOS中扫描二维码的框架,用Swift 4编写。

使用CocoaPods安装

pod 'QRCodeScannerFramework', :git => 'https://github.com/husseinkishk/QRCodeScannerFramework.git', :tag => '1.0.1'

使用

Swift 4

1- 将框架导入到您的ViewController中。

import QRCodeScannerFramework

2- 现在让协议QrScannerDelegate符合以获取扫描数据,如下所示:

extension ViewController: QrScannerDelegate {
    func getScannedData(data: String) {
        print(data) //here's the scan result
    }
}

3- 在您的viewController中创建一个对象。

let vc = QRScannerController()

4- 在viewDidLoad方法中,将此设置为viewController的代理。

vc.qrScannerDelegate = self

5- 导航到QRScannerController。

self.navigationController?.pushViewController(vc, animated: true)

6- 在info.plist文件中添加以下关键字以获取相机权限访问:

Privacy - Camera Usage Description

授权

Copyright (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.