Check Mobile App
Read now
Start a Project

Swift QR Code Scanner & Generator

Save

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 

SwiftQRCode

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.

SEE YA ….

. . .

Leave a Comment

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


Be the first to comment.

css.php

Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.

Osama
Talk to Sales

Global

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