Overriding CBLModel Properties


Assuming you want to attach behaviour to a model property in a CBLModel subclass, like updating a derived but persistent property, what’s the recommended approach?

So, by way of example, say I have two properties, like ‘activeCalories’ and ‘restingCalories’ and a third, ‘totalProperties’, which is simply the derived sum of the two but that we’d like to have in the sand document.

The best way I can see to handle that in a CBLModel subclass is to make all three not @NSManaged/@dynamic properties, and then write my own setters for active/resting that maintain the total, and getters for all three, each using getValueOfProperty setValue:ofProperty.

Does that seem like the right approach? Any other suggestions that seem right?