Last active
January 25, 2019 16:17
-
-
Save danielCarlosCE/564dd683058e3fa86cef728157028ad1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AVCodeReader: AVCaptureMetadataOutputObjectsDelegate { | |
func metadataOutput(_ captureOutput: AVCaptureMetadataOutput, | |
didOutput metadataObjects: [AVMetadataObject], | |
from connection: AVCaptureConnection) { | |
guard let readableCode = metadataObjects.first as? AVMetadataMachineReadableCodeObject, | |
let code = readableCode.stringValue else { | |
return | |
} | |
//Vibrate the phone | |
AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate)) | |
stopReading() | |
didRead?(code) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment