Re: NSTextView backed by core data, undo problems
Re: NSTextView backed by core data, undo problems
- Subject: Re: NSTextView backed by core data, undo problems
- From: Kyle Sluder <email@hidden>
- Date: Fri, 12 Mar 2010 00:07:39 -0800
On Thu, Mar 11, 2010 at 11:38 PM, Martin Hewitson
<email@hidden> wrote:
> Thanks, Kyle. I figured the answer would be something like this. OK, then I'll need to rethink the architecture a bit. I was aiming for an Xcode-like interface with potentially multiple views to the same file content, but without using 'updates continuously' this is going to be more difficult to achieve. If anyone has any good suggestions, I'd be delighted to hear them.
Start by reading the text system documentation, and then re-reading
it. :) Then try to build a simple app that has two windows looking at
the same text storage, so that typing in one causes immediate
corresponding changes in the other. That'll get you the base of what
you need.
As far as integrating with Core Data, you will certainly need custom
logic to translate the NSTextStorage world into the KVC-based
NSManagedObject world. Perhaps you should subclass NSTextStorage for
use in your model objects, and have its special knowledge inform your
NSManagedObject subclass of pertinent changes so it can update its
serialized version of the text as appropriate. This gets you the
updates continuously behavior you want but uses the framework
correctly to do it.
Again, it's not trivial, but certainly not impossible. Our apps certainly do it.
--Kyle Sluder
_______________________________________________
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