Skip to content
/ QRBot Public
forked from hardiiik/QRBot

QRBot, a QR Code Scanning and Generating library for iOS 8+, written in Swift 4.

License

Notifications You must be signed in to change notification settings

carabina/QRBot

 
 

Repository files navigation

QRBot

CI Status Version License Platform

Requirements

iOS 8+

Installation

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

pod 'QRBot'

Usage

Follow the steps to use QRBot:

  1. You need to give permission to access Camera in Info.plist.

Info.plist permission

  1. Make QRCodeScannerViewController superclass of your ViewController class.
 class ViewController: QRCodeScannerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
 }
  1. Conform/ Implement QRCodeScannerDelegate protocol and implement its method to perform your tasks.
 class ViewController: QRCodeScannerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
 }
 extension ViewController: QRCodeScannerDelegate{
    func scanner(_ connection: AVCaptureConnection, didOutput data: String) {
        print("DemoApp : Data from QR Code - \(data)")
        // Perform your actions here with data from QRCode
    }
 }

( If AVCaptureConnection may show any error, just import AVFoundation in your ViewController. )

 import UIKit
 import AVFoundation
 import QRBot
 
 class ViewController: QRCodeScannerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
 }
 extension ViewController: QRCodeScannerDelegate{
    func scanner(_ connection: AVCaptureConnection, didOutput data: String) {
        print("DemoApp : Data from QR Code - \(data)")
        // Perform your actions here with data from QRCode
    }
 }
  1. Set scannerDelegate property of your ViewController to self.
 class ViewController: QRCodeScannerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        scannerDelegate = self
    }
 }
  1. All set. Now implement your tasks in delegate method.

Example

Take a look at Example Project for more clarity. To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Hardik Trivedi, hardiktrivedi3008.ht@gmail.com

License

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

About

QRBot, a QR Code Scanning and Generating library for iOS 8+, written in Swift 4.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 88.1%
  • Ruby 11.9%