Created
May 20, 2017 10:15
-
-
Save jensmeder/286c19d0607c7128e80d023b4f4ae613 to your computer and use it in GitHub Desktop.
Generating QR Codes with Core Image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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