<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/qrCodeGenerator()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)QRCodeGenerator"
  },
  "title" : "qrCodeGenerator()"
}
-->

# qrCodeGenerator()

Generates a quick response (QR) code image.

```
class func qrCodeGenerator() -> any CIFilter & CIQRCodeGenerator
```

## Return Value

The generated image.

## Discussion

This method generates a QR code as an image. QR codes are a high-density matrix barcode format defined in the ISO/IEC 18004:2006 standard.

The QR code generator filter uses the following properties:

- `message`: A `string` representing the data to be encoded as a QR Code as <doc://com.apple.documentation/documentation/Foundation/NSData>.
- `correctionLevel`: A single letter `string` representing the error-correction format as an <doc://com.apple.documentation/documentation/Foundation/NSString>. L is 7 percent correction, M is 15 percent correction, Q is 25 percent correction, and H is 30 percent correction.

The following code creates a filter that generates a QR code:

```swift
func qrCode(inputMessage: String) -> CIImage {
    let qrCodeGenerator = CIFilter.qrCodeGenerator()
    qrCodeGenerator.message = inputMessage.data(using: .ascii)!
    qrCodeGenerator.correctionLevel = "H"
    return qrCodeGenerator.outputImage!
}
```

![An image of a black and white square barcode made of squares representing the encoded data of: Hello world!](images/com.apple.coreimage/media-3546313@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)