Version: 1.0.1
This document describes the current implementation status, ISO compliance, and known limitations.
AztecLib is a pure Swift implementation of Aztec 2D barcode encoding per ISO/IEC 24778. The library generates Aztec symbols that are fully compatible with standard barcode decoders including ZXing and Apple's Vision framework.
| Feature | Status | Notes |
|---|---|---|
| Compact symbols (1-4 layers) | ✅ Complete | 15x15 to 27x27 modules |
| Full symbols (4-32 layers) | ✅ Complete | 31x31 to 151x151 modules |
| Text encoding modes | ✅ Complete | Upper, Lower, Mixed, Punct, Digit |
| Binary/Byte mode | ✅ Complete | Short (1-31 bytes) and long (32+ bytes) forms |
| Mode transitions | ✅ Complete | Latch and shift with cost-based optimization |
| Reed-Solomon encoding | ✅ Complete | GF(2^6), GF(2^8), GF(2^10), GF(2^12) |
| Mode message encoding | ✅ Complete | RS-protected nibble encoding |
| Finder pattern | ✅ Complete | 9x9 (compact) and 13x13 (full) |
| Reference grid | ✅ Complete | For full symbols with large layer counts |
| Data placement | ✅ Complete | Clockwise spiral with layer mapping |
| Codeword stuffing | ✅ Complete | Bit stuffing to avoid all-0/all-1 patterns |
| Configurable error correction | ✅ Complete | 5-95% error correction percentage |
| SwiftUI views | ✅ Complete | AztecSymbolView and AztecCodeView |
The library implements the full 6-step Aztec encoding pipeline:
- Data Encoding - Converts input to bits using optimal mode selection
- Configuration Selection - Picks smallest symbol fitting payload + EC
- Codeword Packing - Packs bits with stuff bits per ISO spec
- Reed-Solomon Encoding - Adds parity codewords for error correction
- Matrix Building - Assembles finder, mode message, grid, and data
- Export - Outputs packed bitmap with configurable bit ordering
| Specification | Compliance | Reference |
|---|---|---|
| Symbol structure | ✅ Compliant | ISO 24778 §7.1 |
| Finder pattern | ✅ Compliant | ISO 24778 §7.2 |
| Orientation pattern | ✅ Compliant | ISO 24778 §7.3 |
| Mode message | ✅ Compliant | ISO 24778 §7.4 |
| Reference grid | ✅ Compliant | ISO 24778 §7.5 |
| Data region | ✅ Compliant | ISO 24778 §7.6 |
| Character encoding | ✅ Compliant | ISO 24778 §8 (Tables 2-6) |
| Codeword stuffing | ✅ Compliant | ISO 24778 §9 |
| Reed-Solomon codes | ✅ Compliant | ISO 24778 §10 |
| Primitive polynomials | ✅ Compliant | ISO 24778 Annex A |
The library implements all five text modes per ISO 24778:
- Upper mode (5 bits): Space + A-Z (codes 1-27)
- Lower mode (5 bits): Space + a-z (codes 1-27)
- Mixed mode (5 bits): Control characters + special symbols (@, , ^, _, `, |, ~)
- Punct mode (5 bits): Punctuation (!, ", #, $, %, etc.) + two-char sequences
- Digit mode (4 bits): Space + 0-9 + comma + period
| Field | Polynomial | Usage |
|---|---|---|
| GF(2^6) | 0x43 (x^6 + x + 1) | Compact symbols |
| GF(2^8) | 0x12D (x^8 + x^5 + x^3 + x^2 + 1) | Full L1-L8 |
| GF(2^10) | 0x409 (x^10 + x^3 + 1) | Full L9-L22 |
| GF(2^12) | 0x1069 (x^12 + x^6 + x^5 + x^3 + 1) | Full L23-L32 |
The library has been validated against ZXing (the reference Aztec implementation):
| Test Case | Result |
|---|---|
| "Hello" encoding | ✅ Identical output |
| "123" encoding | ✅ Identical output |
| "Mixed123Content!@#" | ✅ Identical output |
| Binary data (5 bytes) | ✅ ZXing decodes correctly |
| Binary data (128 bytes) | ✅ ZXing decodes correctly |
| Large payloads (366 bytes) | ✅ ZXing decodes correctly |
The library passes comprehensive validation testing against multiple decoders:
- Apple Vision framework
- zxing-cpp
The following features are planned for future releases:
-
Decoder implementation: Add Aztec decoding support (currently encode-only)
-
Structured Append: Support for multi-symbol encoding of large payloads
-
FNC1 support: Add support for GS1 Aztec Code format
-
Reader Initialization: Add support for reader programming symbols
-
Performance optimization: Profile and optimize for large symbols
Last updated: January 2026 (v1.0.1)