Initializer

init(for:)

Returns the class description for a given class.

Declaration

init?(for aClass: AnyClass)

Parameters

aClass

The class for which to return a class description. See note below for important details.

Return Value

The class description for aClass, or nil if a class description cannot be found.

Discussion

If a class description for aClass is not found, the method posts an NSClassDescriptionNeededForClassNotification on behalf of aClass, allowing an observer to register a class description. The method then checks for a class description again. Returns nil if a class description is still not found.

If you have an instance of the receiver’s class, you can use the NSObject instance method classDescription instead.

See Also

Working with class descriptions

class func invalidateClassDescriptionCache()

Removes all NSClassDescription objects from the cache.

class func register(NSClassDescription, for: AnyClass)

Registers an NSClassDescription object for a given class in the NSClassDescription cache.