Re: UIDocument with NSFileWrapper
Re: UIDocument with NSFileWrapper
- Subject: Re: UIDocument with NSFileWrapper
- From: Quincey Morris <email@hidden>
- Date: Sun, 20 Mar 2016 23:08:13 -0700
- Feedback-id: 167118m:167118agrif8a:167118sI1DE-N1-v:SMTPCORP
On Mar 19, 2016, at 18:54 , email@hidden wrote:
>
> What I’m having trouble understanding is how I store the images (whose filenames will vary from document to document) with NSFileWrapper. In my top level directory do I have my main model file as a JSON file along with a file (JSON or plist) that lists all the images and then have an Image directory that another NSFileWrapper is used to read/write the images (that are stored in the Image subdirectory)?
>
> Or can I simply store all the files without a subdirectory? I still suspect I need to have a file with a fixed name (such as image.plist) that tells me what all the other filenames are to put in the NSFileWrapper (vs. using NSFileManager to ask for the name of all the files).
There’s no correct answer to these questions. It’s a design problem whose answer is whatever works best in your use case. I’d recommend you start by choosing what looks to you like the most straightforward approach, then be prepared to revise your strategy later if it doesn’t work out well. (The amount of code relating to file wrappers is likely to be small relative to the code that generally maintains your data model, so rewriting it shouldn’t be onerous. However, that suggests it would be prudent not to let the wrappers propagate too deeply into the model. Keep them as an artifact of the save mechanism in particular, rather than the data model in general.)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden