EFCorrectionLevel
public enum EFCorrectionLevel : CaseIterable
QR code error correction levels.
Error correction allows QR codes to be read even if they are partially damaged or obscured. Higher correction levels provide better error recovery but reduce the data capacity of the QR code.
## Error Correction Levels
The error correction level determines how much of the QR code can be damaged or obscured while still allowing successful decoding. Each level provides different trade-offs between data capacity and error recovery capability.
## Usage
// Create a QR code with high error correction
let generator = try EFQRCode.Generator(
"Hello World",
errorCorrectLevel: .h,
style: .basic()
)
## Correction Capabilities
- L (Low): 7% of the QR code can be damaged and still be readable
- M (Medium): 15% of the QR code can be damaged and still be readable
- Q (Quartile): 25% of the QR code can be damaged and still be readable
- H (High): 30% of the QR code can be damaged and still be readable
## Data Capacity Trade-offs
Higher error correction levels provide better error recovery but reduce the amount of data that can be stored in the QR code. Choose the level based on:
- L: Use when QR codes will be displayed in high quality and clean environments
- M: Good balance for most general use cases
- Q: Use when QR codes might be slightly damaged or in challenging environments
- H: Use when QR codes might be significantly damaged or in very challenging environments
-
Low error correction level (7%).
Declaration
Swift
case l
-
Medium error correction level (15%).
Declaration
Swift
case m
-
Quartile error correction level (25%).
Declaration
Swift
case q
-
High error correction level (30%).
Declaration
Swift
case h