[](https://travis-ci.org/Bobby Stenly/BSQRCodeReader)
To run the example project, clone the repo, and run pod install
from the Example directory first.
BSQRCodeReader is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "BSQRCodeReader"
To use this reader, add a custom UIView to your View Controller then change the UIView class and module to BSQRCodeReader
. As usual, you can make an outlet in your controller. See the code below :
@IBOutlet weak var reader: BSQRCodeReader!
override func viewDidLoad() {
super.viewDidLoad()
self.reader.delegate = self
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.reader.startScanning()
}
Now you are one step away before you can read QR Code from your app. The last thing, add BSQRCodeReaderDelegate to your UIViewController class and write down your code in func didCaptureQRCodeWithContent(content: String) -> Bool
.
func didCaptureQRCodeWithContent(content: String) -> Bool {
//do something with your QR Code content
// return true if you want to stop the scanning
// return false if you want to continue the scanning
return true
}
Bobby Stenly, [email protected]
BSQRCodeReader is available under the MIT license. See the LICENSE file for more info.