Classes

The following classes are available globally.

  • EFQRCode - A lightweight QR code generator and recognizer for iOS, macOS, tvOS and watchOS.

    EFQRCode is a powerful and flexible QR code library that supports:

    • QR code generation with various styles and customizations
    • QR code recognition from images
    • Multiple output formats (PNG, JPEG, GIF, APNG, PDF, SVG, Video)
    • Animated QR codes
    • Custom styling with icons and watermarks
    • Error correction levels
    • Cross-platform support (iOS, macOS, tvOS, watchOS, visionOS)

    ## Basic Usage

     // Generate a basic QR code
     let generator = try EFQRCode.Generator("Hello World")
     let image = try generator.toImage(width: 200)
    

    ## Features

    • Multiple Styles: Basic, Bubble, 2.5D, Image, Line, Random Rectangle, and more
    • Custom Icons: Add custom icons to QR codes
    • Watermarks: Overlay watermarks on QR codes
    • Animated QR Codes: Create animated QR codes with GIF and APNG support
    • Video Export: Export QR codes as video files (MOV, M4V, MP4)
    • High Performance: Optimized for performance with caching and efficient algorithms
    • Cross Platform: Works on iOS, macOS, tvOS, and watchOS

    ## Requirements

    • iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ / visionOS 1.0+
    • Swift 5.0+
    • Xcode 13.0+
    See more

    Declaration

    Swift

    public class EFQRCode
  • Parameters for QR code styling and customization.

    This class encapsulates the styling parameters used to customize the appearance of QR codes, including icon placement and backdrop configuration.

    ## Usage

     let icon = EFStyleParamIcon(
         image: .static(myIconImage),
         mode: .scaleAspectFill,
         alpha: 0.8,
         borderColor: .black,
         percentage: 0.2
     )
    
     let params = EFStyleParams(
         icon: icon,
         backdrop: .clear
     )
    

    Declaration

    Swift

    public class EFStyleParams
  • Icon configuration for QR code customization.

    This class defines how an icon is displayed in the center of a QR code, including its appearance, size, and positioning.

    ## Usage

     let icon = EFStyleParamIcon(
         image: .static(myLogoImage),
         mode: .scaleAspectFill,
         alpha: 0.9,
         borderColor: .white,
         percentage: 0.25
     )
    
    See more

    Declaration

    Swift

    public class EFStyleParamIcon
  • Backdrop configuration for QR codes.

    See more

    Declaration

    Swift

    public class EFStyleParamBackdrop
  • Backdrop image configuration for QR codes.

    See more

    Declaration

    Swift

    public class EFStyleParamBackdropImage
  • Base class for QR code style implementations.

    This class provides the foundation for all QR code style implementations, defining the interface that all styles must implement.

    Declaration

    Swift

    public class EFQRCodeStyleBase
  • Parameters for 2.5D QR code styling.

    This class defines the styling parameters for 2.5D QR codes, which create a three-dimensional appearance using shading and depth effects. The 2.5D style simulates depth by using different colors for the top, left, and right faces of each module.

    ## Features

    • Three-dimensional appearance with depth simulation
    • Customizable height for data and position modules
    • Multi-color shading (top, left, right faces)
    • Icon and backdrop support
    • Realistic 3D visual effect

    ## Usage

     let params = EFStyle25DParams(
         icon: icon,
         backdrop: backdrop,
         dataHeight: 1.0,
         positionHeight: 1.0,
         topColor: .black,
         leftColor: .darkGray,
         rightColor: .lightGray
     )
    
     let style = EFQRCodeStyle.style25D(params)
    

    ## Visual Characteristics

    • Modules appear to have depth and volume
    • Different colors create shading effects
    • Height parameters control the 3D appearance
    • Creates a modern, sophisticated look
    See more

    Declaration

    Swift

    public class EFStyle25DParams : EFStyleParams
  • 2.5D QR code implementation.

    This class implements the 2.5D QR code rendering, creating QR codes with a three-dimensional appearance using shading and depth effects. The 2.5D style simulates depth by rendering each module with multiple faces using different colors.

    ## Features

    • Three-dimensional appearance with depth simulation
    • Multi-color shading for realistic 3D effect
    • Customizable height for different module types
    • Icon and backdrop support
    • Sophisticated visual appearance

    ## Usage

     let params = EFStyle25DParams(
         dataHeight: 1.0,
         positionHeight: 1.0,
         topColor: .black,
         leftColor: .darkGray,
         rightColor: .lightGray
     )
    
     let style = EFQRCodeStyle25D(params: params)
    
    See more

    Declaration

    Swift

    public class EFQRCodeStyle25D : EFQRCodeStyleBase
  • Parameters for basic QR code styling.

    This class defines the styling parameters for basic QR codes, including alignment patterns, timing patterns, data modules, and position detection patterns. It provides a comprehensive set of customization options for creating traditional QR codes with custom colors and styles.

    ## Features

    • Alignment pattern customization
    • Timing pattern styling
    • Data module appearance
    • Position detection pattern styling
    • Icon and backdrop support

    ## Usage

     let params = EFStyleBasicParams(
         icon: icon,
         backdrop: backdrop,
         position: position,
         data: data,
         align: align,
         timing: timing
     )
    
     let style = EFQRCodeStyle.basic(params)
    
    See more

    Declaration

    Swift

    public class EFStyleBasicParams : EFStyleParams
  • Alignment pattern styling parameters for basic QR codes.

    See more

    Declaration

    Swift

    public class EFStyleBasicParamsAlign
  • Timing pattern styling parameters for basic QR codes.

    This class defines the appearance of timing patterns in QR codes, which are the alternating dark and light modules that help decoders locate the data modules.

    See more

    Declaration

    Swift

    public class EFStyleBasicParamsTiming
  • Data module styling parameters for basic QR codes.

    This class defines the appearance of data modules in QR codes, which encode the actual information content of the QR code.

    See more

    Declaration

    Swift

    public class EFStyleBasicParamsData
  • Position detection pattern styling parameters for basic QR codes.

    This class defines the appearance of position detection patterns (finder patterns) in QR codes, which are the large square patterns in three corners that help decoders locate and orient the QR code.

    See more

    Declaration

    Swift

    public class EFStyleBasicParamsPosition
  • Basic QR code style implementation.

    This class implements the rendering logic for traditional QR codes with customizable alignment, timing, data, and position patterns, as well as icon and backdrop support.

    See more

    Declaration

    Swift

    public class EFQRCodeStyleBasic : EFQRCodeStyleBase
  • Parameters for bubble-style QR code styling.

    This class defines the styling parameters for bubble-style QR codes, which feature rounded, bubble-like data modules with a distinctive appearance. The bubble style creates QR codes with a modern, friendly appearance that stands out from traditional square-based QR codes.

    ## Features

    • Bubble-shaped data modules
    • Customizable data colors
    • Position detection pattern styling
    • Icon and backdrop support
    • Modern, friendly appearance

    ## Usage

     let params = EFStyleBubbleParams(
         icon: icon,
         backdrop: backdrop,
         dataColor: .blue,
         dataCenterColor: .white,
         position: position
     )
    
     let style = EFQRCodeStyle.bubble(params)
    

    ## Visual Characteristics

    • Data modules appear as rounded bubbles
    • Position detection patterns can be styled independently
    • Supports custom colors for different elements
    • Creates a modern, approachable appearance
    See more

    Declaration

    Swift

    public class EFStyleBubbleParams : EFStyleParams
  • Position detection pattern styling parameters for bubble QR codes.

    See more

    Declaration

    Swift

    public class EFStyleBubbleParamsPosition
  • Bubble-style QR code implementation.

    This class implements the bubble-style QR code rendering, creating QR codes with rounded, bubble-like data modules that have a modern and friendly appearance.

    ## Features

    • Rounded data modules with bubble appearance
    • Customizable colors for different elements
    • Position detection pattern styling
    • Icon and backdrop support

    ## Usage

     let params = EFStyleBubbleParams(
         dataColor: .blue,
         dataCenterColor: .white,
         position: position
     )
    
     let style = EFQRCodeStyleBubble(params: params)
    
    See more

    Declaration

    Swift

    public class EFQRCodeStyleBubble : EFQRCodeStyleBase
  • Parameters for DSJ-style QR code styling.

    This class defines the styling parameters for DSJ-style QR codes, which use distinctive position and data module patterns inspired by the “DSJ” visual style.

    ## Features

    • Custom DSJ-style position detection patterns
    • Customizable data module appearance
    • Icon and backdrop support
    • Unique, visually striking QR codes

    ## Usage

     let dataParams = EFStyleDSJParamsData(
         lineSize: 0.7,
         xSize: 0.7,
         horizontalLineColor: .yellow,
         verticalLineColor: .red,
         xColor: .blue
     )
    
     let params = EFStyleDSJParams(
         icon: icon,
         backdrop: backdrop,
         position: position,
         data: dataParams
     )
    
     let style = EFQRCodeStyle.dsj(params)
    
    See more

    Declaration

    Swift

    public class EFStyleDSJParams : EFStyleParams
  • Position detection pattern styling parameters for DSJ QR codes.

    See more

    Declaration

    Swift

    public class EFStyleDSJParamsPosition
  • Data module styling parameters for DSJ QR codes.

    See more

    Declaration

    Swift

    public class EFStyleDSJParamsData
  • DSJ-style QR code implementation.

    This class implements the DSJ-style QR code rendering, creating QR codes with distinctive position and data module patterns inspired by the “DSJ” visual style.

    ## Features

    • Custom DSJ-style position detection patterns
    • Line and X-shaped data modules
    • Multi-color styling for different elements
    • Icon and backdrop support

    ## Usage

     let params = EFStyleDSJParams(
         position: position,
         data: dataParams
     )
    
     let style = EFQRCodeStyleDSJ(params: params)
    
    See more

    Declaration

    Swift

    public class EFQRCodeStyleDSJ : EFQRCodeStyleBase
  • Parameters for function-based QR code styling.

    This class defines the styling parameters for function-based QR codes, which use mathematical functions to determine the appearance of data modules. This creates QR codes with dynamic, algorithmically generated patterns.

    ## Features

    • Function-based data module generation
    • Mathematical pattern algorithms
    • Position detection pattern styling
    • Icon and backdrop support
    • Dynamic, algorithmic appearance

    ## Usage

     let dataParams = EFStyleFunctionParamsData(
         function: .fade(),
         style: .round
     )
    
     let params = EFStyleFunctionParams(
         icon: icon,
         backdrop: backdrop,
         position: position,
         data: dataParams
     )
    
     let style = EFQRCodeStyle.function(params)
    

    ## Visual Characteristics

    • Data modules are generated using mathematical functions
    • Patterns can be fade, wave, or other algorithmic effects
    • Creates dynamic, visually interesting QR codes
    • Maintains QR code structure and scannability
    See more

    Declaration

    Swift

    public class EFStyleFunctionParams : EFStyleParams
  • Position detection pattern styling parameters for function QR codes.

    See more

    Declaration

    Swift

    public class EFStyleFunctionParamsPosition
  • Data module styling parameters for function QR codes.

    See more

    Declaration

    Swift

    public class EFStyleFunctionParamsData
  • Function-based QR code implementation.

    This class implements the function-based QR code rendering, creating QR codes with mathematical functions that determine the appearance of data modules.

    ## Features

    • Mathematical function-based data module generation
    • Dynamic patterns using fade and circle functions
    • Position detection pattern styling
    • Icon and backdrop support

    ## Usage

     let params = EFStyleFunctionParams(
         position: position,
         data: dataParams
     )
    
     let style = EFQRCodeStyleFunction(params: params)
    
    See more

    Declaration

    Swift

    public class EFQRCodeStyleFunction : EFQRCodeStyleBase
  • Parameters for image-based QR code styling.

    This class defines the styling parameters for image-based QR codes, which use actual images to fill the QR code modules instead of solid colors. This creates QR codes that incorporate visual content while maintaining scannability.

    ## Features

    • Image-based module filling
    • Alignment pattern customization
    • Timing pattern styling
    • Position detection pattern styling
    • Data module appearance control
    • Icon and backdrop support

    ## Usage

     let imageParams = EFStyleImageParamsImage(
         image: myImage,
         mode: .scaleAspectFill
     )
    
     let params = EFStyleImageParams(
         icon: icon,
         backdrop: backdrop,
         align: align,
         timing: timing,
         position: position,
         data: data,
         image: imageParams
     )
    
     let style = EFQRCodeStyle.image(params)
    

    ## Visual Characteristics

    • QR code modules are filled with actual image content
    • Maintains QR code structure and scannability
    • Supports different image scaling modes
    • Creates visually appealing, branded QR codes
    See more

    Declaration

    Swift

    public class EFStyleImageParams : EFStyleParams
  • Alignment pattern styling parameters for image-based QR codes.

    This class defines the appearance of alignment patterns in image-based QR codes, including their style, size, and colors for dark and light modules.

    ## Usage

     let align = EFStyleImageParamsAlign(
         style: .rectangle,
         size: 1.0,
         colorDark: .black,
         colorLight: .white
     )
    
    See more

    Declaration

    Swift

    public class EFStyleImageParamsAlign
  • Timing pattern styling parameters for image-based QR codes.

    This class defines the appearance of timing patterns in image-based QR codes, including their style, size, and colors for dark and light modules.

    ## Usage

     let timing = EFStyleImageParamsTiming(
         style: .rectangle,
         size: 1.0,
         colorDark: .black,
         colorLight: .white
     )
    
    See more

    Declaration

    Swift

    public class EFStyleImageParamsTiming
  • Image configuration for module filling in image-based QR codes.

    This class defines how an image is used to fill QR code modules.

    ## Usage

     let imageParams = EFStyleImageParamsImage(
         image: myImage,
         mode: .scaleAspectFill
     )
    
    See more

    Declaration

    Swift

    public class EFStyleImageParamsImage
  • Position detection pattern styling parameters for image-based QR codes.

    This class defines the appearance of position detection patterns in image-based QR codes, including their style, size, and colors for dark and light modules.

    ## Usage

     let position = EFStyleImageParamsPosition(
         style: .rectangle,
         size: 1.0,
         colorDark: .black,
         colorLight: .white
     )
    
    See more

    Declaration

    Swift

    public class EFStyleImageParamsPosition
  • Data module styling parameters for image-based QR codes.

    This class defines the appearance of data modules in image-based QR codes, including their style, scale, and colors for dark and light modules.

    ## Usage

     let data = EFStyleImageParamsData(
         style: .rectangle,
         scale: 1.0,
         colorDark: .black,
         colorLight: .white
     )
    
    See more

    Declaration

    Swift

    public class EFStyleImageParamsData
  • Base class for image-based QR code styling.

    This class provides the foundation for styling QR codes using images. It handles common tasks like writing QR code, icon, and backdrop.

    See more

    Declaration

    Swift

    public class EFQRCodeStyleImage : EFQRCodeStyleBase
  • Parameters for image fill QR code styling.

    This class defines the styling parameters for image fill QR codes, which use images as background with QR code modules as masks. This creates QR codes where the image shows through the QR code pattern.

    ## Features

    • Image background with QR code mask
    • Customizable background and mask colors
    • Icon and backdrop support
    • Image transparency control

    ## Usage

     let imageParams = EFStyleImageFillParamsImage(
         image: myImage,
         mode: .scaleAspectFill,
         alpha: 1.0
     )
    
     let params = EFStyleImageFillParams(
         icon: icon,
         backdrop: backdrop,
         image: imageParams,
         backgroundColor: .white,
         maskColor: .black
     )
    
     let style = EFQRCodeStyle.imageFill(params)
    

    ## Visual Characteristics

    • Image appears as background
    • QR code modules create mask over image
    • Maintains QR code structure and scannability
    • Creates visually appealing QR codes with image content
    See more

    Declaration

    Swift

    public class EFStyleImageFillParams : EFStyleParams
  • Image configuration for image fill QR codes.

    See more

    Declaration

    Swift

    public class EFStyleImageFillParamsImage
  • Image fill QR code implementation.

    This class implements the image fill QR code rendering, creating QR codes where images are used as background with QR code modules as masks.

    ## Features

    • Image background with QR code mask overlay
    • Customizable background and mask colors
    • Image transparency control
    • Icon and backdrop support

    ## Usage

     let params = EFStyleImageFillParams(
         image: imageParams,
         backgroundColor: .white,
         maskColor: .black
     )
    
     let style = EFQRCodeStyleImageFill(params: params)
    
    See more

    Declaration

    Swift

    public class EFQRCodeStyleImageFill : EFQRCodeStyleBase
  • Parameters for line-style QR code styling.

    This class defines the styling parameters for line-style QR codes, which use lines to represent data modules instead of solid blocks. This creates QR codes with a unique, minimalist appearance that maintains scannability.

    ## Features

    • Line-based data module representation
    • Customizable line direction and thickness
    • Position detection pattern styling
    • Icon and backdrop support
    • Minimalist, modern appearance

    ## Usage

     let lineParams = EFStyleLineParamsLine(
         direction: .x,
         thickness: 0.5,
         color: .black
     )
    
     let params = EFStyleLineParams(
         icon: icon,
         backdrop: backdrop,
         position: position,
         line: lineParams
     )
    
     let style = EFQRCodeStyle.line(params)
    

    ## Visual Characteristics

    • Data modules are represented as lines
    • Lines can be oriented horizontally or vertically
    • Thickness controls the visual weight of lines
    • Creates a clean, minimalist appearance
    See more

    Declaration

    Swift

    public class EFStyleLineParams : EFStyleParams
  • Position detection pattern styling parameters for line QR codes.

    See more

    Declaration

    Swift

    public class EFStyleLineParamsPosition
  • Line styling parameters for line QR codes.

    See more

    Declaration

    Swift

    public class EFStyleLineParamsLine
  • Line-style QR code implementation.

    This class implements the line-style QR code rendering, creating QR codes where data modules are represented as lines instead of solid blocks.

    ## Features

    • Line-based data module representation
    • Multiple line direction options
    • Customizable line thickness
    • Position detection pattern styling
    • Icon and backdrop support

    ## Usage

     let params = EFStyleLineParams(
         position: position,
         line: lineParams
     )
    
     let style = EFQRCodeStyleLine(params: params)
    
    See more

    Declaration

    Swift

    public class EFQRCodeStyleLine : EFQRCodeStyleBase
  • Parameters for random rectangle QR code styling.

    This class defines the styling parameters for random rectangle QR codes, which create QR codes with randomly sized and colored rectangles for each dark module. This creates QR codes with a unique, artistic appearance that maintains scannability.

    ## Features

    • Random rectangle generation for each dark module
    • Variable rectangle sizes and colors
    • Artistic, non-uniform appearance
    • Icon and backdrop support
    • Unique visual style

    ## Usage

     let params = EFStyleRandomRectangleParams(
         icon: icon,
         backdrop: backdrop,
         color: .green
     )
    
     let style = EFQRCodeStyle.randomRectangle(params)
    

    ## Visual Characteristics

    • Each dark module is represented by randomly sized rectangles
    • Colors vary around the base color with random offsets
    • Creates an artistic, non-uniform appearance
    • Maintains QR code structure and scannability
    See more

    Declaration

    Swift

    public class EFStyleRandomRectangleParams : EFStyleParams
  • Random rectangle QR code implementation.

    This class implements the random rectangle QR code rendering, creating QR codes with randomly sized and colored rectangles for each dark module. This creates QR codes with a unique, artistic appearance.

    ## Features

    • Random rectangle generation for dark modules
    • Variable sizes and colors based on base color
    • Artistic, non-uniform appearance
    • Icon and backdrop support
    • Unique visual style

    ## Usage

     let params = EFStyleRandomRectangleParams(
         color: .green
     )
    
     let style = EFQRCodeStyleRandomRectangle(params: params)
    
    See more

    Declaration

    Swift

    public class EFQRCodeStyleRandomRectangle : EFQRCodeStyleBase
  • Parameters for resample image QR code styling.

    This class defines the styling parameters for QR codes that use a resampled image as the basis for module coloring. The QR code’s modules are colored by sampling from a source image, creating a visually blended effect between the QR code and the image.

    ## Features

    • Image-based module coloring via resampling
    • Customizable alignment, timing, and position patterns
    • Data module color fallback
    • Icon and backdrop support
    • Visually blended, artistic QR codes

    ## Usage

     let imageParams = EFStyleResampleImageParamsImage(
         image: myImage,
         mode: .scaleAspectFill
     )
    
     let params = EFStyleResampleImageParams(
         icon: icon,
         backdrop: backdrop,
         image: imageParams,
         align: align,
         timing: timing,
         position: position,
         dataColor: .black
     )
    
     let style = EFQRCodeStyle.resampleImage(params)
    
    See more

    Declaration

    Swift

    public class EFStyleResampleImageParams : EFStyleParams
  • Alignment pattern styling parameters for resample image QR codes.

    See more

    Declaration

    Swift

    public class EFStyleResampleImageParamsAlign
  • Timing pattern styling parameters for resample image QR codes.

    See more

    Declaration

    Swift

    public class EFStyleResampleImageParamsTiming
  • Position detection pattern styling parameters for resample image QR codes.

    See more

    Declaration

    Swift

    public class EFStyleResampleImageParamsPosition
  • Image configuration for resampling in resample image QR codes.

    See more

    Declaration

    Swift

    public class EFStyleResampleImageParamsImage
  • QR code style implementation for resample image effect.

    This class implements the rendering logic for QR codes that use a resampled image to color the modules, supporting advanced artistic effects.

    See more

    Declaration

    Swift

    public class EFQRCodeStyleResampleImage : EFQRCodeStyleBase