   // MARK: - AVCapturePhotoCaptureDelegate
 
   func photoOutput(_ output: AVCapturePhotoOutput,
-                   didFinishProcessingPhoto photoSampleBuffer: CMSampleBuffer?,
-                   previewPhoto previewPhotoSampleBuffer: CMSampleBuffer?,
-                   resolvedSettings: AVCaptureResolvedPhotoSettings,
-                   bracketSettings: AVCaptureBracketedStillImageSettings?,
+                   didFinishProcessingPhoto photo: AVCapturePhoto,
                    error: Error?) {
     if let error = error {
       sjlog_error("Error capturing photo: \(error.localizedDescription)", category: .general)

  /// Captures the current image as data and calls the delegate when complete.
  func captureImageData(isCropping: Bool) {
    shouldCropCapturedPhoto = isCropping
    let settings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecJPEG])
    photoOutput.capturePhoto(with: settings, delegate: self)
  }


      return
    }

    guard let photoData = photo.fileDataRepresentation() else {
      sjlog_error("Could not create jpeg photo data representation", category: .general)
      delegate?.photoCapturerDidCapturePhotoData(nil, metadata: nil)
      return
    }

    // Metadata
    var mutableMetadata = photo.metadata
    var exifData = mutableMetadata[kCGImagePropertyExifDictionary as String] as? [String: Any]

    guard let originalImage = UIImage(data: photoData), let cgImage = originalImage.cgImage else {
      sjlog_error("Could not create original image", category: .general)
