Swift QR Code Scanner & Generator


Hi Guys , Are you searching for a quick QR code scanner and generator now here is the one. This post will tell you about…

How to generate and scan a QR code using this fabulous library named 


Its available on Github https://github.com/liufan321/SwiftQRCode

Install the library using CocoaPods and follow these steps and rest will happen itself .

To scan a QR code :- 

  1. Import SwiftQRCode
  2. Create an object of QRCode class.
  3. Provide the scan frame on which your camera will open to scan the QR code into ViewDidLoad
  4. Call the prepareScan method into ViewDidLoad which will return a closure with scanned information from the QR code
  5. Into your viewDidAppear method call the startScan method to start scanning the QR code.

Don’t forget to request for NSCameraUsageDescription in the info.plist

The above code will start your camera into your given scan frame and return the encoded information as String into the prepare scan closure.

To generate a QR code :-

  1. GenerateImage method in the QRCode class will generate the QRCode and set it as a image into your imageView’s image.

The method includes three parameters.

  1. Message to be encode.
  2. avatarImage the avatar(watermark) image over your QR code
  3. avatarScale to provide the scaling to avatar image.

Now you can easily generate and scan the QRCode and save your development time.


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

Markus Walter

Markus Walter

Founder, Das Apartment Living

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home