title: Swift accessing EXIF Dictionary
body: <p>Info: Using Swift and the CGImageSourceCreateWithURL function.</p>
  
  <p>I am attempting to load a file from a URL and then edit a dictionary which has all the data from that particular photo.</p>
  
  <p>This is the code from the .swift file.</p>
  
  <pre><code>    let url = NSURL(string: "http://jwphotographic.co.uk/Images/1.jpg")
      let imageSource = CGImageSourceCreateWithURL(url, nil)
      let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil) as Dictionary
  
      println(imageProperties)
  
      //this is an example
      let aperture = imageProperties[kCGImagePropertyGPSLatitude] as! NSNumber!
  
      /*
      //these are all being defined as nil
      //Load the ones from the exif data of the file
      let lensUsed = imageProperties[kCGImagePropertyExifFocalLength]
      let aperture = imageProperties[kCGImagePropertyExifApertureValue] as!
      let isoSpeed = imageProperties[kCGImagePropertyExifISOSpeedRatings] as! NSNumber
      let latitude = imageProperties[kCGImagePropertyGPSLatitude] as! NSNumber
      let longitude = imageProperties[kCGImagePropertyGPSLongitude] as! NSNumber
      let shutterSpeed = imageProperties[kCGImagePropertyExifShutterSpeedValue] as! NSNumber
      let cameraName = imageProperties[kCGImagePropertyExifBodySerialNumber] as! NSNumber
      */
  
      println(aperture)
  </code></pre>
  
  <p>Even though image properties prints all the data as would be expected, no-matter what I have attmpted to extract from the imageProperties dictionary - it is always returned as null - such as 'aperture' in the example. The imageProperties prints as;</p>
  
  <pre><code>[{TIFF}: {
       Artist = JOHN;
       Copyright = "johnrwatson0@gmail.com";
       DateTime = "2015:07:31 21:07:05";
       Make = Canon;
       Model = "Canon EOS 7D Mark II";
       ResolutionUnit = 2;
       Software = "Adobe Photoshop Lightroom 6.0 (Macintosh)";
       XResolution = 72;
       YResolution = 72;
  }, {IPTC}: {
       Byline =     (
         JOHN
       );
       CopyrightNotice = etc.. etc..
  </code></pre>
  
  <p>I have done a lot of research and testing and I simply cannot work out what I'm doing wrong to access the elements in this dictionary - Could someone give me an example how I would set a variable as the "Model" element inside the dictionary?</p>