How to copy adjustments made in Photos.app to a new photo with PhotoKit

I’ve been trying to figure out a way to copy adjustments made in the native Photos app on macOS to a different photo using PhotoKit or Swift.

My DSLR sends lower quality versions of every photo it takes right to my phone as it takes them, but when I get around to importing the high res copies from the SD card, I’d like to be able to easily copy the favourited status and any edits I may have made to the high res versions.

Copying the isFavourite status and removing the duplicate files was easy, but I can’t figure out a way to copy edits over to the higher quality file. I figured since it’s an easy copy/paste in Photos that it shouldn’t be too difficult with code.

Has anyone managed to pull this off?
How to copy adjustments made in Photos.app to a new photo with PhotoKit
 
 
Q