I am using Swift 3, Xcode 8.2.
A lot of the tutorials that I find on this topic seem to always be in Swift 2. I have a custom camera view already created and I am trying to capture a photo from it.
I've set up an @IBAction
function below. The variable session_output
is AVCapturePhotoOutput
:
@IBAction func shutterButtonPressed() {
session_output.capturePhoto(with: AVCapturePhotoSettings.init(format: [AVVideoCodecKey : AVVideoCodecJPEG]), delegate: <#T##AVCapturePhotoCaptureDelegate#>)
}
I don't know what to put in the delegate
field and how to read the photo from the buffer after it is captured. The difference between Swift 2 and 3 is so stark in this case that I can't even bumble my way through it which I've been fairly successful at doing when following most Swift 2 tutorials.
Any help would be greatly appreciated.
set delegate to self and use this delegate AVCapturePhotoCaptureDelegate
And you can get captured image from below delegate