CBLModel check if model has unsaved property changes

I’d like to check if a CBLModel subclass has unsaved property changes. For example on an edit profile screen, I’d like to update the save button state based on unsaved property value changes. CBLModel.needsSave returns true if a property value is changed and then the value is reverted back. Any suggestions on the best way to check if a model property value has changed?

I’m currently having a CBLModel class confirm to NSCopying to check if unsaved changes have been made to a class’ property values. Was wondering if there is currently a simpler way to handle this.

Something like [in Swift] model.propertiesToSave == model.document.properties should work.

1 Like