title: How do I set a computed NSManagedObject property automatically before it is saved?
body: <p>Say I have an <code>NSManagedObject</code> subclass called <code>Item</code>. Whenever an <code>item</code> instance is saved I want to update a property based on a computed value from a transient property. I know I can update the property whenever the transient property changes but for this question, assume there's a good reason I don't want to do that.</p>
  
  <p>I tried to do this in the <code>willSave</code> method as follows:</p>
  
  <pre><code>- (void)willSave
  {
      self.computedProperty = [self computedValueFromTransientProperty];
  }
  </code></pre>
  
  <p>This causes a crash when saving the context. If I move the code out of <code>willSave</code> and set the property explicitly before invoking save it works fine. The apple docs say you should avoid changing managed object properties in <code>willSave</code>.</p>
  
  <p>QUESTION: is there a good way to build functionality into a <code>NSManagedObject</code> subclass so a property can be updated just before save w/o having to explicitly set the property from outside the class and w/o setting the property every time the transient property changes?</p>