title: How can I obtain a metadata value from AVCapturePhoto?
body: <p>I am currently working on capturing an image using AVFoundation. As I want to use the captured image on a Vision Framework workflow, I need its orientation when converting it to a UIImage. How can I achieve that?
  From the documentation I found that AVCapturePhoto has a .metadata dictionary to access that information, but if I use the corresponding key I get nil as a result.</p>
  
  <p>Here's my delegate method for the capture routine:</p>
  
  <pre><code>    func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
      // capture image finished
      print("Image captured.")
      print(photo)
      print(photo.metadata["kCGImagePropertyOrientation"]) // CGImageProperties for metadata keys for value retrieval.
  </code></pre>
  
  <p>I found the key under "CGImageProperties>Individual Image Properties". The print(photo) does show me an image has actually been captured, returning: </p>
  
  <blockquote>
    <p>AVCapturePhoto: 0x1c1013940 pts:98386.095931 1/1 settings:uid:3  photo:{4032x3024 SIS:ON}</p>
  </blockquote>
  
  <p>Please answer in Swift. :)</p>
  
  <p>Thanks!</p>