This is a helper library for capturing barcode or QR written in Swift.
On calling presentBarcodeReader
, capturing View Controller will be modaled.
You can specifiy AVMetadataObjectTypes
as enum, requirement of change camera position button and handling result/error using closure.
import SwiftBarcodeReader
func appear(){
presentBarcodeReader(scanTypes: [.EAN13Code], //you can specify code type to scan type as enum value
needChangePositionButton: true, // If you need change position button, pass `true`
success: { (type, value) in
print("type:\(type) value:\(value)")
self.resultLabel.text = "\(value)"
}) {(canceled, error) in
//cancel handle when tapped back button
if canceled {
print("canceled")
}
//error handle when occured some error
if error != nil {
print("error:\(error)")
}
}
}
- Xcode 8 and Swift 3.0
- iOS 8.0 and later
pod "SwiftBarcodeReader"
Prepare Cartfile, then add below.
github "d-date/SwiftBarcodeReader"
Run below on Terminal.
carthage update --platform-iOS
Daiki Matsudate(@d_date)
If you want to add new feature or fix bug, make an issue first and try to contact me.
SwiftBarcodeReader is available under the MIT license. See the LICENSE file for more info.
- Custermizable Capturing UI
- Show Capturing Rect