Skip to content

Instantly share code, notes, and snippets.

@danielCarlosCE
Created January 7, 2017 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielCarlosCE/97d534f1c076f8d67a6856bbdf873389 to your computer and use it in GitHub Desktop.
Save danielCarlosCE/97d534f1c076f8d67a6856bbdf873389 to your computer and use it in GitHub Desktop.
private func isCodeInLimitBounds(codeReadable: AVMetadataMachineReadableCodeObject) -> Bool {
if let videoLayer = previewLayer as? AVCaptureVideoPreviewLayer,
let transformedObj = videoLayer.transformedMetadataObject(for: codeReadable),
let limitBounds = limitBounds {
return limitBounds.contains(transformedObj.bounds)
}
//ignore 'failure' above
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment