couchbaselabs / CouchCocoa

Objective-C API for CouchDB on iOS and Mac OS
http://couchbaselabs.github.com/CouchCocoa/docs/
218 stars 66 forks source link

CouchModel: ability to distinguish an external change (change tracker) from model being created with document, from model being reverted #64

Open mz2 opened 11 years ago

mz2 commented 11 years ago

It would be great to have separate overloadable public methods similar to -didLoadFromDocument for the three cases of:

1) model being created with document. 2) change tracker induced change to a model object. 3) a failed save of a model object.

Currently all three cases result in -didLoadFromDocument: being sent to the CouchModel object affected. This is because the method -didLoadFromDocument is called by both -initWithDocument: and by -couchDocumentChanged:, which in turn is called by -CouchDocument's -notifyChanged: and the error case in CouchModel's -saveCompleted:

mz2 commented 11 years ago

Looks like overloading -couchDocumentChanged: in a CouchModel subclass makes it respond to only the cases 2 and 3 noted above. Something on these lines:

}

Is there some way to get a response to only a change tracker induced change (isolate cases 2 and 3 from each other)?