aztecCodeGenerator()
Generates a low-density barcode.
Declaration
class func aztecCodeGenerator() -> any CIFilter & CIAztecCodeGeneratorReturn Value
The generated image.
Discussion
This method generates an Aztec code as an image. The Aztec barcode code is a low-density barcode defined in the ISO/IEC 24778:2008 standard. This code is commonly used for transport ticketing or boarding passes.
The Aztec code generator filter uses the following properties:
messageThe data to be encoded as an Aztec code. An NSData object whose display name is Message.
correctionLevelA
floatrepresenting the percentage of redundancy to add to the message data. A higher correction level allows the barcode to be correctly read even when partially damaged.layersA
floatrepresenting the number of concentric squares encoding the barcode data. When the value is zero, Core Image automatically determines the appropriate number of layers to encode the message data at the specified correction level.compactStyleA
floatdetermining the use of compact or full-size Aztec barcode format. The compact format can store up to 44 bytes of message data in up to 4 layers. The full-size format can store up to 1914 bytes of message data in up to 32 layers. Leave unset, or set to 0 for automatic.
The following code creates a filter that generates an Aztec barcode:
func aztecCode(inputMessage: String) -> CIImage {
let aztecCodeGenerator = CIFilter.aztecCodeGenerator()
aztecCodeGenerator.correctionLevel = 15
aztecCodeGenerator.compactStyle = 0
aztecCodeGenerator.message = inputMessage.data(using: .ascii)!
aztecCodeGenerator.layers = 10
return aztecCodeGenerator.outputImage!
}[Image]
See Also
Filters
attributedTextImageGenerator()barcodeGenerator()blurredRectangleGenerator()checkerboardGenerator()code128BarcodeGenerator()lenticularHaloGenerator()meshGenerator()pdf417BarcodeGenerator()qrCodeGenerator()randomGenerator()roundedRectangleGenerator()roundedRectangleStrokeGenerator()starShineGenerator()stripesGenerator()sunbeamsGenerator()