iOS 14 added captions to Photos. Can we access them?

New in iOS 14, we can now drag a photo up in the Photos app and add a caption.

Is it possible to access this caption via PhotoKit or any other framework?

I don't see a field for it on PHAsset. I've also tried the following snippet to see if I can see them stored on the image:

Code Block swift
let assets = PHAsset.fetchAssets(with: .image, options: nil)
assets.enumerateObjects { (asset, index, stop) in
let options = PHContentEditingInputRequestOptions()
options.isNetworkAccessAllowed = true
asset.requestContentEditingInput(with: options) { (input, properties) in
guard let input = input,
let fullSizeImageURL = input.fullSizeImageURL,
let imageSource = CGImageSourceCreateWithURL(fullSizeImageURL as CFURL, nil),
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil) else {
return
}
dump(imageProperties)
}
}


My understanding is that the caption does not get stored with the image metadata until the photo is exported (e.g. Share->SaveToFiles).    Instead the caption is stored in a seperate place.   I was told by Apple Developer Technical Support (DTS) that there is no API to retrieve this.   However I have seen at least one App Store app that does.  There’s another similar question posted at https://developer.apple.com/forums/thread/665185 .
Just wondering if anyone has been able to solve this. I've also come across a couple apps in that are able to read the caption just fine, but I've not been able to read via PHAsset or other means (3rd party libs).

Those apps probably do it via SQL query, but if there is a way to do it via Photokit it would be great to know.

iOS 14 added captions to Photos. Can we access them?
 
 
Q