Post

Replies

Boosts

Views

Activity

API for new "Keep Downloaded" feature in iCloud Drive?
It looks like in iOS 18, there is a new option in Files to "Keep Downloaded". I.e., mark a file to be downloaded and never evicted. Is there an API that would allow us to provide this feature in our app? Our app stores files in a ubiquitous container and displays them in a custom UI (not a UIDocumentBrowserViewController). We've had a longstanding request from users that they be able to mark a file as always available locally, so that they can make sure they have access to it even if they go offline. We've done a hacky, best-effort implementation of this, but there is no truly reliable way to achieve this through the existing APIs.
1
1
362
Jun ’24
How to do a postorder enumeration of a directory?
How do I accomplish a postorder enumeration of a directory (that is, get subdirectories before the parents)? Normally I would use FileManager.enumerator(at:includingPropertiesForKeys:options:errorHandler:) for enumeration. And there is a DirectoryEnumerationOptions named includesDirectoriesPostOrder. Unfortunately it does not seem to work. If I create the enumerator like this: FileManager.default.enumerator(at: url, includingPropertiesForKeys: resourceKeys, options: [.skipsPackageDescendants, .skipsHiddenFiles, .includesDirectoriesPostOrder]) The enumerator does not provide the results postorder. And in fact if you check the isEnumeratingDirectoryPostOrder, it returns false. Am I using this incorrectly, or is it just broken? Is there some other way to accomplish this? I see that CFURLEnumerator has a similar option, though I don't know if it works any better. Plus I would rather not wrestle with Core Foundation code if I can avoid it.
4
0
537
Jun ’24