Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aztec barcode encoding library for iPhone

I've been searching for a library that can convert a string to an Aztec barcode for display on an iPhone screen, and I haven't been able to find anything. Anyone know of one?

There are a couple of QR code generators, but that's a different thing. It's integrating with an existing system, so it has to be Aztec.

We have no need to scan or decode barcodes, only to display them.

Thanks.

like image 939
grahamparks Avatar asked Feb 26 '23 16:02

grahamparks


1 Answers

You don't need a third party library — Aztec barcode generation has been part of the built-in Core Image framework since iOS 8 / macOS 10.10. (It also generates QR codes, Code128, and PDF417 barcodes.) Here's a quick example (in Swift 3):

let data = "Xiuhcoatl, the turquoise serpent of the fires".data(using: .utf8)!
let aztec = CIFilter(name: "CIAztecCodeGenerator",
    withInputParameters: [ "inputMessage" : data ])!
    .outputImage!

And the image it produces: aztec barcode of aztec mythology

See the docs for CIAztecCodeGenerator for additional options on that filter, and Core Image Programming Guide for general info on using Core Image.

like image 50
rickster Avatar answered Mar 02 '23 21:03

rickster