Swiftpack.co -  spothero/BarcodeHero-iOS as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
spothero/BarcodeHero-iOS
SpotHero's library for generating and scanning barcodes.
.package(url: "https://github.com/spothero/BarcodeHero-iOS.git", from: "0.7.3")

BarcodeHero

CI Status Latest Release Swift Version Platform Support License

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.

Features

  • ☑ Generates images for numerous barcode types.
  • ☑ Validates barcode data prior to generation.
  • ☑ Handles errors with ease. (Nearly every method is marked with throws and 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.

Formats

Supported

  • ☑ 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

Unsupported

  • ☐ Codabar
  • ☐ Code 39 Extended
  • ☐ Data Matrix
  • ☐ MaxiCode
  • ☐ RSS-14
  • ☐ RSS-Expanded
  • ☐ UPC-A

Requirements

  • iOS 10.0+
  • Xcode 9.0+
  • Swift 4.0+

Installation

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 section:

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

CocoaPods is a dependency manager for Cocoa projects.

We no longer support CocoaPods for versions later then 0.5.0.

Usage

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 CGSize or UIImageView without aliasing or blur:

try image.resizeTo(barcodeImageView)
try image.resizeTo(CGSize(width: 100, height: 20), forContentMode: .scaleAspectFit)

Communication

For all bug reports, feature requests, and general communication, please open an issue to get in contact with us.

GitHub

link
Stars: 5
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

0.5.0: BarcodeHeroUI Target Support
1 year ago

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 BHCameraScanController.

When SPM introduces resource support, we can circle back and update this... or perhaps even leverage SwiftUI instead where available.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics