-
Notifications
You must be signed in to change notification settings - Fork 22
Debug Description
Patrick-Kladek edited this page May 25, 2017
·
3 revisions
This class creates a Textual representation of your objects.
Call this method and you get a nicely formatted output.
+ (CocoaDebugDescription *)debugDescriptionForObject:(NSObject *)obj;
Usage:
// Create some object
Person *person = [[Person alloc] init];
[person setImage:[NSImage imageNamed:@"image.jpg"]];
[person setFirstName:@"Patrick"];
[person setLastName:@"Kladek"];
[person setBirthday:[NSDate dateWithString:@"1996-07-04 01:00:00 +0100"]];
// Create description
NSLog([[CocoaDebugDescription debugDescriptionForObject:person] stringRepresentation]);
Output:
2017-05-25 18:47:26.309 Test Application[29862:303] <0x10027f570> Person {
NSImage image = size: 800x800
NSString firstName = Patrick
NSString lastName = Kladek
NSDate birthday = 1996-07-04 00:00:00 +0000
}