Last active
August 30, 2016 07:58
-
-
Save danielgalasko/c648065abb12af9e5d9a to your computer and use it in GitHub Desktop.
Using dictionaryWithValuesForKeys to get a great object description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)description { | |
//We list the properties and their values using the ever convenient `dictionaryWithValuesForKeys` | |
//which will get the values of the corresponding properties | |
NSDictionary *debugProperties = [self dictionaryWithValuesForKeys:@[NSStringFromSelector(@selector(<#Insert property name#>))]]; | |
return [NSString stringWithFormat:@"<%@: %p> %@", self.class, self, debugProperties]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment