Latest 1.0.1
Homepage https://github.com/hoggenw/YLSwiftScan
License MIT
Platforms ios 8.0
Frameworks UIKit, Foundation, AVFoundation
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

YLSwiftScan is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "YLSwiftScan"

Author

dev-wangliugen

调用方法

注意要在.plist设置相机相关的权限

        //初始化
        let manager = YLScanViewManager.shareManager()
        //视图UI相关的设置更改,可以不做设置,使用默认配置
       // 是否需要边框
       //manager.isNeedShowRetangle = true
       //扫描框的宽高比
       // manager.whRatio = 1
       //相对中心点Y的偏移
       //manager.centerUpOffset = -20
       //扫描框的宽度
       // manager.scanViewWidth = 160
       //扫描框的颜色
       //manager.colorRetangleLine = UIColor.red
       //4角与扫描框的位置关系
       //manager.photoframeAngleStyle = YLScanViewPhotoframeAngleStyle.Outer
       //扫描框4角的颜色
       //manager.colorAngle = UIColor.red
       //扫码区域4个角的线条宽度
       //manager.photoframeLineW = 4
       //扫描动画的样式,自带4种样式
       // manager.imageStyle = YLAnimationImageStyle.secondeNetGrid
       //自定义扫描动画
       manager.animationImage = image
       //添加扫描成功返回代理
        manager.delegate = self
       //显示(viewController要求有UINavigationController)
        manager.showScanView(viewController: self) 

在YLScanViewManagerDelegate的代理中处理成功后返回的数据

    func scanSuccessWith(result: YLScanResult) {
         print("wlg====%@",result.strScanned!)
    }

二维码的生成

 //  frame: 生成视图的frame
 //  logoIconName:是否需要logo。可选
 //  codeMessage: 二维码包含信息
 //例如
 let codeView = manager.produceQRcodeView(frame: CGRect(x: (self.view.bounds.size.width - 200)/2, y: self.view.bounds.size.height/2, width: 200, height: 200), logoIconName: nil,codeMessage: "wlg's test Message")

License

YLSwiftScan is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "YLSwiftScan",
    "version": "1.0.1",
    "summary": "u5b9eu73b0u4e8cu7ef4u7801u626bu63cfu8bc6u522bu548cu751fu6210u4e8cu7ef4u7801",
    "description": "u4f7fu7528Manageru7ba1u7406u4ee5u65b9u4fbfu7684u8c03u7528u4ee5u5b9eu73b0u4e8cu7ef4u7801u626bu63cfu548cu7ed3u679cu8fd4u56deuff0cu56feu7247u4e8cu7ef4u7801u8bc6u522buff0cu4e8cu7ef4u7801u751fu6210u7b49uff0cu53c2u8003u4e86LBXScan",
    "homepage": "https://github.com/hoggenw/YLSwiftScan",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "dev-wangliugen": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hoggenw/YLSwiftScan.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "YLSwiftScan/Classes/**/*",
    "resource_bundles": {
        "YLSwiftScan": [
            "YLSwiftScan/Assets/*.png"
        ]
    },
    "frameworks": [
        "UIKit",
        "Foundation",
        "AVFoundation"
    ],
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This