MBFormattedDescriptionObject Class Reference

Inherits from NSObject
Conforms to MBFormattedDescription
Declared in MBFormattedDescriptionObject.h

Overview

Provides support for basing an object’s description method on the MBFieldListFormatter, for giving objects a way to create more legible console log output.

Intended to make debugging more efficient by making it easier to see what’s inside an object.

Constructing the description

– addDescriptionFieldsTo:

Asks the receiver to add any relevant fields to the passed-in MBFieldListFormatter instance.

- (void)addDescriptionFieldsTo:(nonnull MBFieldListFormatter *)fmt

Parameters

fmt

The formatter to which description fields should be added.

Discussion

Note: Subclasses should call super prior to adding their own fields.

Declared In

MBFormattedDescriptionObject.h

Debugging output

– debugDescriptor

Implemented by subclasses that wish to provide an additional means of identifying an object instance within the debug console.

- (nullable NSString *)debugDescriptor

Return Value

If a non-nil value is returned by this method, a field named “debugDescriptor” will be added to the consoleDescription.

Discussion

The default implementation returns nil.

Declared In

MBFormattedDescriptionObject.h

– consoleDescription

Uses an MBFieldListFormatter instance in conjunction with the addDescriptionFieldsTo: method to construct a description of the receiver intended for output to the console.

- (nonnull NSString *)consoleDescription

Return Value

The console description.

Declared In

MBFormattedDescriptionObject.h

– dump

Writes the output of the receiver’s consoleDescription method to the console log.

- (void)dump

Declared In

MBFormattedDescriptionObject.h

Object description

– description

Overrides the NSObject implementation to return the output of consoleDescription.

- (nonnull NSString *)description

Return Value

The return value of calling the consoleDescription

Declared In

MBFormattedDescriptionObject.h