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 existi开发者_如何学Pythonng system, so it has to be Aztec.
We have no need to scan or decode barcodes, only to display them.
Thanks.
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:
See the docs for CIAztecCodeGenerator
for additional options on that filter, and Core Image Programming Guide for general info on using Core Image.
精彩评论