Get EXIF Data from Image in Swift

From PeformIQ Upgrade
Jump to navigation Jump to search

This seems to work:


import ImageIO
...

func getExif(_ uRLToTheImageFile: URL)
{
    if let imageSource = CGImageSourceCreateWithURL(fileURL as CFURL, nil) {
        let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil)
        if let dict = imageProperties as? [String: Any] {
            print(dict)
        }
    }
}

From - http://stackoverflow.com/questions/40175160/exif-data-read-and-write