Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created May 10, 2018 19:50
Show Gist options
  • Save azamsharp/fa78547213050f41d5ecb95dedb196d7 to your computer and use it in GitHub Desktop.
Save azamsharp/fa78547213050f41d5ecb95dedb196d7 to your computer and use it in GitHub Desktop.
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
if let barcodeDetector = self.barcodeDetector {
let visionImage = VisionImage(buffer: sampleBuffer)
barcodeDetector.detect(in: visionImage) { (barcodes, error) in
if let error = error {
print(error.localizedDescription)
return
}
for barcode in barcodes! {
print(barcode.rawValue!)
self.barCodeRawValueLabel.text = barcode.rawValue!
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment