Swiftpack.co -  Appracatappra/SwiftletBarcodes as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Appracatappra/SwiftletBarcodes
Creates a Barcode as a Image representing the given data (as a String) in the given BarcodeFormat.
.package(url: "https://github.com/Appracatappra/SwiftletBarcodes.git", from: "1.0.4")

SwiftletBarcodes for Swift and SwiftUI

Creates a Barcode as a Image representing the given data (as a String) in the given BarcodeFormat. SwiftletBarcodes can generate barcodes in the following formats:

  • Code 128
  • PDF 417
  • Aztec
  • QR Code

There are two forms of the generate function:

  • One generates the requested barcode at the system specified size.
  • The other generates the barcode at a given width and height.

NOTE: Barcode generation is NOT supported on watchOS and is only included as a stub to support cross platform development.

Installation

Swift Package Manager (Xcode 11 and above)

  1. Select File > Swift Packages > Add Package Dependency… from the File menu.
  2. Paste https://github.com/Appracatappra/SwiftletBarcodes.git in the dialog box.
  3. Follow the Xcode's instruction to complete the installation.

Why not CocoaPods, or Carthage, or blank?

Supporting multiple dependency managers makes maintaining a library exponentially more complicated and time consuming.

Since, the Swift Package Manager is integrated with Xcode 11 (and greater), it's the easiest choice to support going further.

Using SwiftletBarcodes

SwiftletBarcodes in very easy to use in you SwiftUI app. The following example shows how to generate barcodes with either of the two generate functions.

Example:

// At system size
let barcodeA = SwiftletBarcodes.generate(from:"142208819120", format:.code128)
 
// At a given width and height
let barcodeB = SwiftletBarcodes.generate(from:"142208819120", format:.code128, width:250, height:100)

Additionally, SwiftletBarcodes include a pre-made SwiftUI View to display a barcode card, SwiftletBarcodeView.

Example

The following is an example of displaying the SwiftletBarcodeView on an iOS device:

SwiftletBarcodeView(showTitle: true, title:"Loyalty Card", showData: true, data: "1 12208 81912 0", format: .code128, hasDivider: true, width: 380, height: 150)

Will result in a screen like the following being displayed:

GitHub

link
Stars: 1
Last commit: 3 weeks 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.

Release Notes

1.0.4
3 weeks ago

Downgrade tooling to Swift Package Manager 5.3

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