title: How to get ImageBuffer correctly in Swift now with CMSampleBufferGetImageBuffer?
body: <p><a href="https://i.stack.imgur.com/qG3yz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qG3yz.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>'CMSampleBufferGetImageBuffer' has been replaced by property
    'CMSampleBuffer.imageBuffer'</p>
  </blockquote>
  
  <p>CMSampleBufferGet.ImageBuffer doesn't work :) It seems parameters also being changed regarding to Swift 4.2.</p>
  
  <pre><code>guard let pixelBuffer: CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return }
  </code></pre>
  
  <p>Entire function. Just in case ... </p>
  
  <pre><code>    func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
  //        print("Camera was able to capture a frame:", Date())
  
          guard let pixelBuffer: CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return }
          guard let model = try? VNCoreMLModel(for: ARS().model) else { return }
          let request = VNCoreMLRequest(model: model) { (finishedReq, err) in
  
              guard let results = finishedReq.results as? [VNClassificationObservation] else { return }
              guard let firstObservation = results.first else { return }
  
              print(firstObservation.identifier, firstObservation.confidence)
  
              DispatchQueue.main.async {
                  self.identifierLabel.text = "\(firstObservation.identifier) \(firstObservation.confidence * 100)"
              }
  
          }
  
          try? VNImageRequestHandler(cvPixelBuffer: pixelBuffer, options: [:]).perform([request])
      }
  </code></pre>
  
  <p>Did anyone try to solve this or has a reference for the new syntax?</p>