Skip to content

Instantly share code, notes, and snippets.

@echoz
Created June 14, 2012 19:42
Show Gist options
  • Save echoz/2932465 to your computer and use it in GitHub Desktop.
Save echoz/2932465 to your computer and use it in GitHub Desktop.
Nothing wrong with messaging nil
// Consider an accessor setter method
-(void)setUniqueIDString:(NSString *)uid {
if (uid != _uid) {
[_uid release];
_uid = [uid copy];
}
}
// You can do [object setUniqueIDString:nil] and not crash.
// It also semantically makes sense whether _uid is nil or has an object assigned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment