Integrating with Photos on macOS

WWDC 2018

Posted by Den on September 29, 2018 · 6 mins read
Integrating with Photos on macOS

Integrating with Photos on macOS

WWDC 2018

Integrating with Photos on macOS

WWDC 2018

Project Categories ( new )

PHProjectInfo

PHProjectInfo Updates ( new )

Updating appends sections for new assets

Regions of Interest ( new )

Supporting Copy and Paste ( new )

  • Implement validateMenuItem(_ menuItem: NSMenuItem)
  • Only return true if the extension can handle the current pasteboard content

Supporting Drag and Drop

  • Photos handles drags of assets to the extension by default
  • The extension should only handle extension-internal drags

Interacting with Photos

Problem
Solution — File Promise Providers

Drag and Drop on macOS

  • Uses NSPasteboard
  • Data is written and read using the main thread

Then and Now

  • Only local content
  • Read and Write file URLs to the pasteboard
  • Data in iCloud with Optimized Local Storage
  • Privacy Settings

File Promises

What is a file promise ?

  • Promise that a file of a certain type will be written to a provided location
  • Allows the sender to write a promised file in the background
  • NSFilePromiseReceiver
  • NSFilePromiseProvider
  • What’s New in Cocoa ( WWDC 2016 )

File Promise Providers

Providing File Promises when the data isn’t available on disk