Type Method

new

Allocates a new instance of the receiving class, sends it an init message, and returns the initialized object.

Declaration

+ (instancetype)new;

Return Value

A new instance of the receiver.

Discussion

This method is a combination of alloc and init. Like alloc, it initializes the isa instance variable of the new object so it points to the class data structure. It then invokes the init method to complete the initialization process.

See Also

Creating, Copying, and Deallocating Objects

alloc

Returns a new instance of the receiving class.

allocWithZone:

Returns a new instance of the receiving class.

init

Implemented by subclasses to initialize a new object (the receiver) immediately after memory for it has been allocated.

copy

Returns the object returned by copyWithZone:.

copyWithZone:

Returns the receiver.

mutableCopy

Returns the object returned by mutableCopyWithZone: where the zone is nil.

mutableCopyWithZone:

Returns the receiver.

dealloc

Deallocates the memory occupied by the receiver.