iosswift4avcaptureoutput

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


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

 }

Solution

  • 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.