After Imigrating to Swift 4 an AVCaptureOutput function has been stopped being called?

696 Views Asked by At

After immigrating Swift 4 following function has been stopped being called. I could not find the reason.

  func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, from connection: AVCaptureConnection!) {

        Code

 }
1

There are 1 best solutions below

1
On BEST ANSWER

After making Xcode 9 making suggestion by starting writing function

      func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {

   code

}

Suggested and I replaced

            func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, from connection: AVCaptureConnection!) {

with

           func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {

Now, it has been called.