Enumerations

The following enumerations are available globally.

  • Alignment styles for QR code elements.

    See more

    Declaration

    Swift

    public enum EFStyleParamAlignStyle : CaseIterable
  • Timing pattern styles for QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleParamTimingStyle : CaseIterable
  • Data module styles for QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleParamsDataStyle : CaseIterable
  • Position detection pattern styles for QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleParamsPositionStyle : CaseIterable
  • Image parameter for QR code styling.

    See more

    Declaration

    Swift

    public enum EFStyleParamImage
  • QR code style enumeration.

    This enum provides all available QR code styles and their corresponding parameter types and implementations.

    See more

    Declaration

    Swift

    public enum EFQRCodeStyle
  • Data module style options for basic QR codes.

    This enum defines the visual appearance options for data modules in basic QR code styles.

    See more

    Declaration

    Swift

    public enum EFStyleBasicParamsDataStyle : CaseIterable
  • Mathematical functions for data module generation.

    See more

    Declaration

    Swift

    public enum EFStyleFunctionParamsDataFunction
  • Data module style options for function QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleFunctionParamsDataStyle : CaseIterable
  • Alignment pattern styles for image-based QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleImageParamAlignStyle : CaseIterable
  • Timing pattern styles for image-based QR codes.

    These styles define how timing patterns appear in image-based QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleImageParamTimingStyle : CaseIterable
  • Line direction options for line-style QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleLineParamsLineDirection : CaseIterable
  • Alignment pattern style options for resample image QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleResampleImageParamAlignStyle : CaseIterable
  • Timing pattern style options for resample image QR codes.

    See more

    Declaration

    Swift

    public enum EFStyleResampleImageParamTimingStyle : 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
    See more

    Declaration

    Swift

    public enum EFCorrectionLevel : CaseIterable
  • Image scaling modes for QR code watermark and icon positioning.

    This enum defines how images (watermarks, icons) are scaled and positioned within QR codes. Each mode provides different behavior for handling aspect ratios and image fitting.

    ## Scaling Modes

    • scaleToFill: Stretches the image to fill the entire area, potentially distorting it
    • scaleAspectFit: Scales the image to fit within the area while maintaining aspect ratio
    • scaleAspectFill: Scales the image to fill the area while maintaining aspect ratio, potentially cropping

    ## Usage

     let icon = EFStyleParamIcon(
         image: .static(myImage),
         mode: .scaleAspectFill,  // Use aspect fill mode
         alpha: 1.0,
         borderColor: .black,
         percentage: 0.2
     )
    

    ## Visual Comparison

    | Mode | Behavior | Aspect Ratio | Cropping | Distortion | |——|———-|————–|———-|————| | scaleToFill | Stretches to fill | Changed | No | Yes | | scaleAspectFit | Fits within bounds | Maintained | No | No | | scaleAspectFill | Fills bounds | Maintained | Yes | No |

    See more

    Declaration

    Swift

    public enum EFImageMode : CaseIterable
  • All possible errors that could occur when working with EFQRCode.

    This enum defines all the error types that can be thrown by EFQRCode operations, including data encoding errors, image generation errors, and internal implementation errors.

    ## Error Categories

    • Data Errors: Related to input data encoding and capacity
    • Image Generation Errors: Related to image creation and processing
    • Color Space Errors: Related to color space conversion and creation
    • Internal Errors: Related to internal implementation issues

    ## Usage

     do {
         let generator = try EFQRCode.Generator("Hello World")
         let image = try generator.toImage(width: 200)
     } catch EFQRCodeError.dataLengthExceedsCapacityLimit {
         print("Data is too large for QR code")
     } catch EFQRCodeError.text(let text, let encoding) {
         print("Cannot encode '\(text)' with \(encoding)")
     } catch {
         print("Other error: \(error)")
     }
    
    See more

    Declaration

    Swift

    public enum EFQRCodeError : Error
  • Supported video formats for QR code animation export.

    This enum defines the video formats that can be used to export animated QR codes as video files. Each format has different characteristics in terms of compatibility, file size, and quality.

    ## Supported Formats

    • MOV: Apple’s native format, best compatibility with Apple ecosystem
    • MP4: Widely supported format, good for cross-platform use
    • M4V: Apple’s container format, optimized for iTunes and Apple devices

    ## Usage

     let generator = try EFQRCode.Generator("Hello World")
    
     // Export as MOV video
     let movData = try generator.toMovData(width: 200)
    
     // Export as MP4 video
     let mp4Data = try generator.toMp4Data(width: 200)
    
     // Export as M4V video
     let m4vData = try generator.toM4vData(width: 200)
    

    ## Format Comparison

    | Format | Apple Ecosystem | Cross-Platform | File Size | Quality | |——–|—————–|—————–|———–|———| | MOV | Excellent | Good | Medium | High | | MP4 | Good | Excellent | Small | High | | M4V | Excellent | Limited | Medium | High |

    ## Requirements

    • AVFoundation framework must be available
    • Not available on watchOS
    See more

    Declaration

    Swift

    public enum EFVideoFormat