# How to Install the EFQRCode Swift Library: CocoaPods, Carthage, and SPM Guide

> Install the EFQRCode Swift library with ease using CocoaPods, Carthage, or Swift Package Manager. Generate and recognize QR codes in your app today.

- Repository: [EFPrefix/efqrcode](https://github.com/efprefix/efqrcode)
- Tags: getting-started
- Published: 2026-03-01

---

**Add EFQRCode to your Xcode project using CocoaPods (`pod 'EFQRCode', '~> 7.0.3'`), Carthage (`github "EFPrefix/EFQRCode" ~> 7.0.3`), or Swift Package Manager (URL: `https://github.com/EFPrefix/EFQRCode.git`), then import with `import EFQRCode` to access the Generator and Recognizer APIs.**

The **EFQRCode** library from the **EFPrefix/EFQRCode** repository provides a pure-Swift solution for generating and recognizing QR codes across Apple platforms. Installing the EFQRCode Swift library via your preferred dependency manager exposes the complete API for creating static and animated QR codes with custom styles. This guide details the exact installation steps for CocoaPods, Carthage, and Swift Package Manager, including verification code and key source file references.

## Installation Methods for the EFQRCode Swift Library

EFQRCode supports three major dependency managers. Choose the method that aligns with your project's existing workflow.

### CocoaPods Installation

CocoaPods manages library dependencies through a centralized specification repository. To install EFQRCode via CocoaPods:

1. Add the pod to your `Podfile`:

   ```ruby
   pod 'EFQRCode', '~> 7.0.3'
   ```

2. Execute the installation:

   ```bash
   pod install
   ```

3. Open the generated `.xcworkspace` file.

4. Import the module in your Swift source files:

   ```swift
   import EFQRCode
   ```

The **EFQRCode.podspec** file defines the library's source file patterns and module map, ensuring that [`Source/EFQRCode.swift`](https://github.com/efprefix/efqrcode/blob/main/Source/EFQRCode.swift) and its dependencies compile correctly into your project.

### Carthage Installation

Carthage builds dependencies as binary frameworks, giving you explicit control over integration. To install EFQRCode via Carthage:

1. Add the dependency to your `Cartfile`:

   ```ogdl
   github "EFPrefix/EFQRCode" ~> 7.0.3
   ```

2. Build the framework for your target platforms:

   ```bash
   carthage update --platform iOS,macOS,tvOS,watchOS
   ```

3. In Xcode, drag the built `EFQRCode.framework` from `Carthage/Build` into the "Frameworks, Libraries, and Embedded Content" section of your target.

4. Import the library:

   ```swift
   import EFQRCode
   ```

The Carthage build process compiles the core generation logic from `Source/EFQRCode+Generator.swift` and recognition capabilities from `Source/EFQRCode+Recognizer.swift` into a reusable framework.

### Swift Package Manager Installation

Swift Package Manager provides native dependency management integrated directly into Xcode. To install EFQRCode via SPM:

1. In Xcode, choose **File ▸ Add Packages…**.

2. Enter the repository URL:

   ```

   https://github.com/EFPrefix/EFQRCode.git
   ```

3. Select the version rule (e.g., "Up to Next Minor from 7.0.3").

4. Xcode automatically adds the package and links the `EFQRCode` product to your target.

5. Import the module:

   ```swift
   import EFQRCode
   ```

The **Package.swift** manifest lists the library targets, including the core source files and the `Source/Styles/` and `Source/Extension/` directories required for full functionality.

## Verifying Your EFQRCode Installation

Confirm successful installation by generating and recognizing a test QR code. The following examples utilize the public API exposed through [`Source/EFQRCode.swift`](https://github.com/efprefix/efqrcode/blob/main/Source/EFQRCode.swift).

Generate a simple QR code:

```swift
import EFQRCode
import UIKit

let generator = try? EFQRCode.Generator(
    "https://github.com/EFPrefix/EFQRCode",
    style: .basic()
)

if let cgImage = try? generator?.toImage(width: 300).cgImage {
    let qrImage = UIImage(cgImage: cgImage)
    // Successfully generated QR code image
}

```

Test recognition capabilities:

```swift
import EFQRCode

if let testImage = UIImage(named: "test.png")?.cgImage {
    let recognizer = EFQRCode.Recognizer(image: testImage)
    let codes = recognizer.recognize()
    print("Detected \(codes.count) QR codes")
}

```

Successful execution confirms that `Source/EFQRCode+Generator.swift` and `Source/EFQRCode+Recognizer.swift` compiled correctly and that the style structs in `Source/Styles/` are accessible.

## Key Source Files in EFQRCode

Understanding the library structure helps troubleshoot installation issues:

| Path | Purpose |
|------|---------|
| [`Source/EFQRCode.swift`](https://github.com/efprefix/efqrcode/blob/main/Source/EFQRCode.swift) | Public namespace; exports `Generator` and `Recognizer` classes. |
| `Source/EFQRCode+Generator.swift` | Core QR-code generation engine supporting static and animated output. |
| `Source/EFQRCode+Recognizer.swift` | QR-code detection using CoreImage and ImageIO. |
| `Source/Styles/*.swift` | Visual style definitions (basic, bubble, 25D, image fill, etc.). |
| `Source/Extension/*.swift` | Platform extensions for `UIImage`, `NSImage`, `CGImage`, and numeric types. |
| [`Package.swift`](https://github.com/efprefix/efqrcode/blob/main/Package.swift) | SPM manifest defining targets and platform requirements. |
| `EFQRCode.podspec` | CocoaPods specification listing source files and module map. |

When you install EFQRCode using any package manager, these files compile into your project, exposing the full API for QR code creation and scanning.

## Summary

- **CocoaPods**: Add `pod 'EFQRCode', '~> 7.0.3'` to your Podfile, run `pod install`, and import with `import EFQRCode`.
- **Carthage**: Add `github "EFPrefix/EFQRCode" ~> 7.0.3` to your Cartfile, run `carthage update`, and embed the resulting framework.
- **Swift Package Manager**: Add `https://github.com/EFPrefix/EFQRCode.git` via **File ▸ Add Packages…** and select version 7.0.3 or later.

All methods expose the `Generator` and `Recognizer` classes defined in [`Source/EFQRCode.swift`](https://github.com/efprefix/efqrcode/blob/main/Source/EFQRCode.swift), enabling immediate QR code generation via `Source/EFQRCode+Generator.swift` and recognition via `Source/EFQRCode+Recognizer.swift`.

## Frequently Asked Questions

### What is the minimum iOS version required for EFQRCode?

EFQRCode requires iOS 12.0 or later, macOS 10.11 or later, tvOS 12.0 or later, and watchOS 5.0 or later. These minimum versions are defined in the [`Package.swift`](https://github.com/efprefix/efqrcode/blob/main/Package.swift) manifest and ensure compatibility with the CoreImage and ImageIO frameworks used by `Source/EFQRCode+Generator.swift` and `Source/EFQRCode+Recognizer.swift`.

### Can I use EFQRCode in a macOS or watchOS app?

Yes, EFQRCode supports macOS, iOS, tvOS, and watchOS. When installing via Carthage, specify your target platforms using `--platform iOS,macOS,tvOS,watchOS`. The library's platform-specific extensions in `Source/Extension/` provide convenience methods for `NSImage` on macOS and `UIImage` on iOS, ensuring consistent API behavior across all supported operating systems.

### How do I troubleshoot import errors after installing EFQRCode?

If `import EFQRCode` fails, verify your installation method-specific steps. For CocoaPods, ensure you opened the `.xcworkspace` file rather than the `.xcodeproj` file. For Carthage, confirm that `EFQRCode.framework` appears in your target's "Frameworks, Libraries, and Embedded Content" section. For Swift Package Manager, check that the package appears in "Package Dependencies" and that the `EFQRCode` product is linked to your target.

### What are the main classes available after installing EFQRCode?

After installation, you gain access to the `Generator` and `Recognizer` classes defined in [`Source/EFQRCode.swift`](https://github.com/efprefix/efqrcode/blob/main/Source/EFQRCode.swift). The `Generator` class (implemented in `Source/EFQRCode+Generator.swift`) creates static and animated QR codes with styles defined in `Source/Styles/`. The `Recognizer` class (found in `Source/EFQRCode+Recognizer.swift`) detects QR codes in images using CoreImage. Both classes become available immediately after importing with `import EFQRCode`.