Understanding Optimized Storage in macOS 10.12

The following can be found in the WWDC 2016 session 239 (Crafting Modern Cocoa Apps) pdf on page 154 and 155 (around 41:14 in the video).


page 154:


Documents in the Cloud


With iCloud Drive, any document can end up in the cloud


macOS Sierra brings important changes to iCloud Drive


* The ~/Desktop and ~/Documents folders may be synced via iCloud

* Local copies of documents may be evicted to free up space


page 155:


Documents in the Cloud

Using file coordination for cloud documents


Register a NSFilePresenter to ensure that the document isn’t evicted out from under you


Use NSFileCoordinator to coordinate reading and writing

* File coordination will make sure the file is downloaded and up to date


___________________________________________

I've failed to turn up any other info, but I assume that the "iCloud Design Guide" holds some relevance as Optimized Storage appears to be iCloud based.


I'm currently working on an macOS app that accesses random folders containing images (read only) - think of it as an app that deals with slide shows or photo galleries i.e. one that may need to access collections of images (files) from time to time.


The session slides appear to imply that:


  • NSFilePresenter needs to be used to "hold on to" a file while it's being accessed.
  • Files may be moved off the local disk and that NSFileCoordinator will be needed to ensure that the file gets downloaded when accessed. This poses a number of questions:

- what happens if NSFileCoordinator isn't used?

- what is actually left on the local disc?

- can full folder trees be moved of the disk or only single files?

- can I scan folders and subfolders for image files when the folders are no longer stored locally?


EDIT: what happens if the files are large, the internet is slow or a larger number of files need to be accessed - most file access methods are synchronous so would this not risk stal the app for some users or result in slow "gallery" downloads & updates?