I am trying to get full (read/write) access to the Photos Library - use case is I want to access the library, create/delete albums and move assets into/out of albums, as well as delete them from the library. I've already gone the MLMediaLibrary way, but in that case I can only get read access.
In the new 10.13 API the Photos package has been made available to OSX, however many of the functions are still only available for iOS per the documentation. In particular all findAsset functions are unavailable in OSX. In other words, I cannot find an entry point into the API to get PHAssets! I have tried looking into the MLMedia assets to see if there is a way to migrate the id into the Photos framework, to no avail. Could not find examples not relating to iOS either.
Any help appreciated! Ideally looking for a Swift solution, but open to Obj-C as well.
Thanks E.
The Photos framework is available on macOS only for restricted use cases:
In macOS 10.11 (El Capitan) and later you can create Photo Editing Extensions. These appear in the Photos app when the user goes to edit a photo — you provide a view controller, and Photos provides you the content of the (single) photo/video to be edited and lets you return edited photo/video content.
In macOS 10.13 (High Sierra) and later you can also create Photo Project Extensions. These also appear in the Photos app, when the user goes to create a project (like the books, calendars and other physical print products you've been able to order from Apple ever since iPhoto 1.0 many years ago). Photos provides your extension with a list of assets chosen by the user, and access to photo data for those assets, so that you can create your own book, website, coffee mug, or whatever from them.
There's no support for using Photos / PhotosUI (aka PhotoKit) in macOS outside of these use cases. An app linking against Photos framework gets no access (not even read only access) to the user's Photos library.