Instance Method

description(withLocale:indent:)

Returns a string that represents the contents of the array, formatted as a property list.

Declaration

func description(withLocale locale: Any?, indent level: Int) -> String

Parameters

locale

An NSLocale object or an NSDictionary object that specifies options used for formatting each of the array’s elements (where recognized). Specify nil if you don’t want the elements formatted.

level

A level of indent, to make the output more readable: set level to 0 to use four spaces to indent, or 1 to indent the output with a tab character.

Return Value

A string that represents the contents of the array, formatted as a property list.

Discussion

The returned NSString object contains the string representations of each of the array’s elements, in order, from first to last. To obtain the string representation of a given element, description(withLocale:indent:) proceeds as follows:

  • If the element is an NSString object, it is used as is.

  • If the element responds to description(withLocale:indent:), that method is invoked to obtain the element’s string representation.

  • If the element responds to description(withLocale:), that method is invoked to obtain the element’s string representation.

  • If none of the above conditions is met, the element’s string representation is obtained by invoking its description method.

See Also

Creating a Description

var description: String

A string that represents the contents of the array, formatted as a property list.

func description(withLocale: Any?)

Returns a string that represents the contents of the array, formatted as a property list.