Build Your QR Code Reader

Get a QR code reader with Apple’s integrated AVFoundation library

Orazio Conte
4 min readSep 1, 2020

The QR Codes are two-dimensional barcodes designed by the automotive industry in 1994, but now widely used in many fields such as banking, industrial, commercial or social.

In the projects you are working on, this technology may need to be integrated, so let’s see how to build a QR code reader with the AVFoundation library in Swift .

We go to work

After creating a new project in Xcode the first thing to do is go to info.plist, to set the camera permissions.

Now you have to add a new key, scrolling down to Privacy - Camera use description and then you have to set a relative string

Like in this screen:

I wrote Used to scan the QR Code, but you can write other.

Well, now for have a good look create a viewfinder in .png format, to include in the project.

As you can see, to make the demo more beautiful, I’ve also included a navigation controller.

--

--