Latest 1.0.0
Homepage https://github.com/niklasberglund/NSObject-description
License MIT
Platforms ios 5.0, osx 10.7
Authors

NSObject-description

Helps you produce description method output formatted same way as Apple’s classes’ description output.

Usage

Manually pass attribute names and values

Override the class’ - (NSString *)description method to have it return the NSString produced by - (NSString *)descriptionWithMembers:. Pass a NSDictionary with names and values of your object’s attributes to descriptionWithMembers: like so:

- (NSString *)description
{
    return [self descriptionWithMembers: @{
        @"firstName:": self.firstName,
        @"lastName": self.lastName,
        @"phoneNumber": phoneNumber
    }];
}

Automatically fetch attributes

You can have your - (NSString *)description method return a NSString representation of your class without manually passing the attributes manually like so:

- (NSString *)description
{
    return [self descriptionWithAllProperties];
}

Latest podspec

{
    "name": "NSObject+description",
    "version": "1.0.0",
    "summary": "Helps you produce description method output formatted same way as Apple's classes' description output",
    "description": "Helps you produce description method output formatted same way as Apple's classes' description output. Have your custom - (NSString *)description methods return the output from descriptionWithMembers: and manually specify attributes or have all properties of your object included automatically by using descriptionWithAllProperties.",
    "homepage": "https://github.com/niklasberglund/NSObject-description",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Niklas Berglund": "[email protected]"
    },
    "platforms": {
        "ios": "5.0",
        "osx": "10.7"
    },
    "source": {
        "git": "https://github.com/niklasberglund/NSObject-description.git",
        "tag": "1.0.0"
    },
    "source_files": "NSObject+description.{h,m}"
}

Pin It on Pinterest

Share This