Latest 1.0.1
Homepage https://github.com/YuraChudnick/YCBarcodeReader
License MIT
Platforms ios 10.0
Authors

CocoaPods Compatible
Platform
Language

YCBarcodeReader
YCBarcodeReader

Installation

For YCBarcodeReader, use the following entry in your Podfile:


pod 'YCBarcodeReader'

Then run pod install.

In any file you’d like to use YCBarcodeReader in, don’t forget to import the framework with import YCBarcodeReader.

Usage

Code-less Storyboard Implementation

  1. Added Privacy – Camera Usage Description in Info.plist.
    YCBarcodeReader

  2. Create a UIView in interface builder and assign custom class YCBarcodeReaderView.

YCBarcodeReader

  1. Setup YCBarcodeReaderView from storyboard.

YCBarcodeReader

In storyboard you can setup:

  • Show/hide torch button;
  • Set position to torch button:

    Position Parameter
    Bottom left bottomLeft
    Bottom right bottomRight
    Top left topLeft
    Top Right topRight
  • Set edge insets;
  • Change torch button image for on/off mode;
  • Set on/off landscape orientation;
  • Show/hide focus view;
  • Change border color of focus view;
  • Change border line width of focus view;
  • Set size of focus view.
  1. Then connect delegate in view controller.
import UIKit
import YCBarcodeReader

class ViewController: UIViewController {

    @IBOutlet weak var barcodeReader: YCBarcodeReaderView!

    override func viewDidLoad() {
        super.viewDidLoad()

        barcodeReader.delegate = self
    }

}

extension ViewController: YCBarcodeReaderDelegate {

    func reader(didReadCode code: String, type: String) {
        print(code)
    }

    func reader(didReceiveError error: Error) {
        print(error)
    }

}
  1. Setup programmatically.
import UIKit
import YCBarcodeReader

class ViewController: UIViewController {

    @IBOutlet weak var barcodeReader: YCBarcodeReaderView!

    override func viewDidLoad() {
        super.viewDidLoad()

        barcodeReader.delegate = self
        barcodeReader.showTorchButton = true
        barcodeReader.torchButtonPosition = .topLeft
        barcodeReader.torchButtonInsets = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
        barcodeReader.landscapeOrientation = true
        barcodeReader.focusViewShowed = true
        barcodeReader.focusViewBorderColor = .yellow
        barcodeReader.focusViewLineWidth = 5
        barcodeReader.focusViewSize = CGSize(width: 250, height: 180)
    }

}

Author

YuraChudnick, [email protected]

License

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

Latest podspec

{
    "name": "YCBarcodeReader",
    "version": "1.0.1",
    "summary": "The framework for reading barcodes and qrcodes.",
    "description": "The framework for reading barcodes and qrcodes. Instructions for installationn  are in [the README](https://github.com/YuraChudnick/YCBarcodeReader).",
    "homepage": "https://github.com/YuraChudnick/YCBarcodeReader",
    "license": {
        "type": "MIT",
        "file": "License.md"
    },
    "authors": {
        "Y.Chudnick": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/YuraChudnick/YCBarcodeReader.git",
        "tag": "1.0.1"
    },
    "source_files": [
        "YCBarcodeReader",
        "YCBarcodeReader/*.swift"
    ],
    "resources": [
        "YCBarcodeReader/Resources/*.png"
    ],
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This