Start a Project

Scan Barcode in iOS

Scan Barcode

When you want to use scan the barcode from your iPhone or iPad. You have to import the AVFoundation library (Just write import AVFoundation in a class where you are using barcode scanning no need to add a framework) to use a barcode scanner. You have to use the  AVCaptureMetadataOutputObjectsDelegate delegate method to use AVCapture classes. Declare these variables in your class where you want to implement the Scanner action:-

Then implement the video capturing using AVCaptureSession. in qrcodeFrameView is the view where the camera scan the barcode so you can change its height and width according to your view. First, you have to create the instance of the AVCaptureDeviceInput.

Then you gave to use the delegate method: –

And override the delegate method to get the functionality of barcode from which you get to know the text of barcode and you can use this text anywhere where you want to use and you can also set the timer 1 sec so from there you will get the exact value of barcode text:-

 

 

Exit mobile version