title: Can I override how @synthesize works in Objective C?
body: <p>I'm creating a base class that has an <code>isDirty</code> flag.  It is set any time one of its properties changes, but since it's a base class, it doesn't know what its properties are.  So basically, on every subclass, I have to override every <code>- set:</code> method to something like this:</p>
  
  <pre><code>- (id) setName:(NSString *)value {
    if ([name isEqualToString:value]) {
      return;
    }
    [name autorelease];
    name = [value retain];
    isDirty = YES;  //Here's the important bit
  }
  </code></pre>
  
  <p>Almost every line of that is what the automatically-synthesized setter would do.  Is there any way I can override what <code>@synthesize</code> actually creates?</p>
  
  <p>There are other options I have come up with, but they all seem like they would be much slower at runtime than this method.  I've thought of things like adding an object to observe its own property changes, or creating a generic function to do all that and just pass in the  address to the iVar and the new value, but that still requires overriding the setter.</p>
  
  <p>Any ideas?  If it makes a difference, it's for an iPhone app.</p>