I have overridden a synthesized property because I wanted to add an NSAssert.
Is this OK to do (i.e override) or considered bad practice?
@synthesize someField;
-(NSString*)someField {
NSAssert(someField != nil,@"someField");
return someField;
}
That is fine. From the documentation:
You use the @synthesize keyword to tell the compiler that it should synthesize the setter and/or getter methods for the property if you do not supply them within the @implementation block.
So if you provide them, then the compiler will use yours, irrespective of the @synthesize directive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With