> On 04 Feb 2015, at 19:43, Alex Zavatone <z...@mac.com> wrote: > > All too often, I have a simple data class that is just a bunch of properties > of cocoa collections. > > When walking through the debugger, it would be nice if these classes could > auto describe. > > Consider this. I have a class with the properties of NSStrings that are > firstname, lastname, address. > > Calling description or debugDescription on an instance of the class simply > prints out the memory location. > > Is there something that I'm missing here? I don't want to manually enter > each of the names of each of the properties to be exposed through a > description method. Is there a means to extend NSObject to auto describe the > top level of properties that are NSStrings, NSDictionaries, NSSets and so on > and automatically dump them to the console? > > How would you think about implementing this? It seems like I run into this > need year after year after year.
Have a look at: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/index.html#//apple_ref/doc/uid/20000050-SW25 You can obtain the attributeKeys, and from there, obtain the value of the attributes and therefore implement a -description and/or -debugDescription including them. -- __Pascal J. Bourguignon__ _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com