   // 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)

      return
    }

    guard let photoSampleBuffer = photoSampleBuffer else {
      sjlog_error("Photo sample buffer was nil", category: .general)
      delegate?.photoCapturerDidCapturePhotoData(nil, metadata: nil)
      return
    }

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

    // Metadata
    let metadata = CMCopyDictionaryOfAttachments(
        allocator: nil,
        target: photoSampleBuffer,
        attachmentMode: CMAttachmentMode(kCMAttachmentMode_ShouldPropagate)) as NSDictionary?
    let mutableMetadata = CFDictionaryCreateMutableCopy(nil,
                                                        0,
                                                        metadata) as NSMutableDictionary
    let exifData = mutableMetadata.value(forKey: kCGImagePropertyExifDictionary as String) as?
        NSMutableDictionary

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

    }

    // Done!
    delegate?.photoCapturerDidCapturePhotoData(finalImageData,
                                               metadata: mutableMetadata as NSDictionary)
  }

}
