Created
May 14, 2020 21:45
-
-
Save Danesz/2a0d966650e155d52fbba396f610f531 to your computer and use it in GitHub Desktop.
CameraViewController.swift - photoOutput
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
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) { | |
//process single image | |
guard let imageData = photo.fileDataRepresentation() | |
else { return } | |
let captureImageView = UIImageView(frame: CGRect(x: 50, y: 50, width: 100, height: 100)) | |
let image = UIImage(data: imageData) | |
captureImageView.image = image | |
//show the captured image | |
let centerView = UIView(frame: CGRect(x: UIScreen.main.bounds.size.width / 2 - 100, | |
y: UIScreen.main.bounds.size.height / 2 - 100, | |
width: 200, | |
height: 200)) | |
centerView.backgroundColor = UIColor.red | |
centerView.addSubview(captureImageView) | |
self.view.addSubview(centerView) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment