BarcodeHero is a library that allows you to generate and scan barcodes.
:warning: The code in this library has been provided as-is. SpotHero uses this library in Production, but it may lack the documentation, stability, and functionality necessary to support external use. While we work on improving this codebase, use this library at your own risk and please reach out if you have any questions or feedback.
- ☑ Generates images for numerous barcode types.
- ☑ Validates barcode data prior to generation.
- ☑ Handles errors with ease. (Nearly every method is marked with
throwsand errors are clear and concise.)
- ☑ Separates submodules by function so you only take what you need.
- ☑ Contains a camera scan controller for easy implementation into your own app.
- ☑ Aztec (native)
- ☑ Code 39
- ☑ Code 39 mod 43
- ☑ Code 128 (native)
- ☑ EAN-8
- ☑ EAN-13 (ISBN-13, ISSN-13)
- ☑ Interleaved 2 of 5
- ☑ ITF-14
- ☑ PDF417 (native)
- ☑ QR (native)
- ☑ UPC-E
- ☐ Codabar
- ☐ Code 39 Extended
- ☐ Data Matrix
- ☐ MaxiCode
- ☐ RSS-14
- ☐ RSS-Expanded
- ☐ UPC-A
- iOS 10.0+
- Xcode 9.0+
- Swift 4.0+
Swift Package Manager
Swift Package Manager is built into the Swift toolchain and is our preferred way of integrating the SDK.
For Swift package projects, simply add the following line to your
Package.swift file in the
dependencies: [ .package(url: "https://github.com/spothero/BarcodeHero-iOS", .upToNextMajor(from: "<version>")), ]
For app projects, simply follow the Apple documentation on adding package dependencies to your app.
CocoaPods is a dependency manager for Cocoa projects.
We no longer support CocoaPods for versions later then
You can easily generate a barcode by doing the following:
let image = try BHBarcodeGenerator.generate(.qr, withData: "Example")
There are also extensions for resizing the barcode to a
UIImageView without aliasing or blur:
try image.resizeTo(barcodeImageView) try image.resizeTo(CGSize(width: 100, height: 20), forContentMode: .scaleAspectFit)
For all bug reports, feature requests, and general communication, please open an issue to get in contact with us.
You may find interesting
0.5.0: BarcodeHeroUI Target Support - 2019-10-14 20:20:02
BarcodeHeroUI is now supported via SPM. In order to support SPM, we had to drop all resources from the package. This meant programmatically assigning constraint and otherwise to the
When SPM introduces resource support, we can circle back and update this... or perhaps even leverage
SwiftUI instead where available.
0.4.0: SPM Support - 2019-10-08 00:25:12
0.2.2: Native Barcode Type Parameter Support - 2019-10-08 00:30:25
Cleaned up the
BHCameraScanController and properly implemented
BHFilterParameters for the native barcode types so a user can pass in values properly.
0.2.1: BHCameraScanController fixes - 2019-10-08 00:29:38
Fixes issues with the
podspec as well as errors in
0.2.0: BHCameraScanController, subspec support - 2019-10-08 00:28:51
BHCameraScanController, which allows the reading of all
UI subspecs are now implemented.
0.1.0: Proof of Concept - 2019-10-08 00:27:56
The initial implementation of BarcodeHero.
This version includes support for generating the following barcode types: Aztec, Code 39, Code 39 mod 43, Code 128, EAN-8, EAN-13, ISBN-13, ISSN-13, Interleaved 2 of 5, ITF-14, PDF417 QR, and UPC-E.
The podspec is separate into two subspecs: Core and UI. Core is complete, but UI is untested and unfinished.