Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shoebox / Library applications with Auto-Save & Versions in OS X Lion

We have a shoebox-style application that we want to make a first-class citizen in Lion. This means integrating Auto-Save & Versions among other things. Currently we don’t have a document-centric model and we just use a plain Core Data stack.

UIPersistentDocument provides a really easy way to integrate both Auto-Save & Versions and I see two options we could choose from to integrate with the new APIs:

  1. “Abuse” NSPersistentDocument for our shoebox-style application. Technically it would be a document-based application, but the user interface would still be the same iPhoto-like library. This makes conceptually not a lot of sense, but we would get a lot of functionality for free.
  2. Keep the current plain Core Data stack and implement Auto-Save & Versions manually.

I heard contradicting opinions from Apple representatives about the approach we should take and it would be great to clarify things before we start our implementation. While I think that 1. shouldn’t be used it’s also very tempting, because we get a lot for free. I couldn’t even find sufficient documentation on manually implementing Auto-Save & Versions in a Core Data application.

I would really tend to use 1. but I see some problems:

  • I’m worried about file-system-level conflicts when using versions and only one database-file. I couldn’t find any documentation regarding this topic.
  • I’m worried about performance issues in Versions when browsing through “space”.
  • We can’t enforce only one instance of the open database, since Versions has to open several instances. I’m worried about side-effects and concurrency issues. Conceptually it looks like a hack and I don’t like hacks.

If we would only want to integrate iCloud sync I definitely wouldn’t think about using a document-centric model for our application, because Core Data supports it directly. I’m mostly worried about the developer overhead we would have if we would stick to our current non-document based paradigm.

Do you have any advice or ideas how shoebox applications should be integrated in the new Lion world?

like image 980
Rafael Bugajewski Avatar asked Jul 31 '11 12:07

Rafael Bugajewski


1 Answers

I'm afraid you're forced into using the first option. Versions is implemented inside NSDocumentController *sic* and so you will have to use some kind of NSDocument to get anything out of versions. I think you also have to add your App's Window in a NSWindowController to that document in order to get the nice little popup menu at the top. The problem is that versions is more or less a completely opaque feature...

But there's a question you gotta answer yourself: What portions of your app would you want to put into version? Does it really make sense to have everything in a single file when it comes to restoring data? Version restore (other than copy&paste) happens on the file-system level. And thus, does it really make sense to always have everything restored at once? If your answer is no, you probably even have to slit up you model into multiple smaller files...

Don't expect improvement here until the next major release. That's what I guessed from the engineers comments...

like image 154
Max Seelemann Avatar answered Oct 01 '22 13:10

Max Seelemann