This is an example code of QR Code & Barcode reader with using IOS 11 and Swift 4.0.

To prevent our QR code reader from appearing on the app’s main screen, I created “ScannerViewController” class. Also I added a TabBar item to pass that screen. If you want to apply another method to passing, you can remove code part begin with “required init”.


The program wants permission to access camera. For that permission screen, we need to add a row in “Info.plist” file. Add “Privacy – Camera Usage Description” with value “Can program access your camera for QR reading?” or somethink like this.


Lastly, create an empty View Controller in Main.storyboard and connect it to “ScannerViewController” class.

Important tips: Your Mac simulator may not work for qr code reader. Please use real iPhone for simulating.

You can ask your questions in the comments part of the page.