Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jensmeder/286c19d0607c7128e80d023b4f4ae613 to your computer and use it in GitHub Desktop.
Save jensmeder/286c19d0607c7128e80d023b4f4ae613 to your computer and use it in GitHub Desktop.
Generating QR Codes with Core Image
import Foundation
import UIKit
import PlaygroundSupport
let data = "Hello World!".data(using: .utf8)!
let filter = CIFilter(name: "CIQRCodeGenerator", withInputParameters: ["inputMessage" : data, "inputCorrectionLevel":"L"])
let image = filter!.outputImage!
let img = UIImage(ciImage: image)
PlaygroundPage.current.liveView = UIImageView(image: img)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment