On Mar 19, 2016, at 10:18 , davel...@mac.com wrote:
> 
> The downside I see for my app is that UIDocument writes out the data to a 
> temporary location and then moves it to the new location so I think my app 
> will constantly be writing out these image/PDF files that never change. Is 
> there a better way to do this so that the image/PDF files only get written 
> out when they’re first added (or changed if they do get changed).


a. It’s not obvious that the unchanged files *are* written to a temporary 
location and then moved. The trick is to keep the original directory wrapper 
that you got when opening the file, and to preserve the individual file 
wrappers for unchanged components. (You can, for example, just delete the file 
wrappers for things that *are* changed, when they’re changed, then add the 
missing wrappers at save time.) The save mechanism then knows what has and has 
not been changed, and can optimize the save appropriately.

b. Even if the files are copied, it’s not obvious that you need “a better way”. 
It may be fine to copy the files at every save.

I’d recommend you don’t try to solve this problem until it forces itself on you 
as an actual problem.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to