Instance Method


Initializes and returns an empty document object.


- (instancetype)init;

Return Value

An initialized NSDocument object.


This initializer (the designated initializer) is invoked by each of the other NSDocument initialization methods.

You can override this method to perform initialization that must be done both when creating new empty documents and when opening existing documents. Your override must invoke super to initialize private NSDocument instance variables. It must never return nil. If an error can occur during object initialization, check for the error in an override of initWithType:error:, initWithContentsOfURL:ofType:error:, or initForURL:withContentsOfURL:ofType:error:, because those methods can return NSError objects.

See Also

Creating a Document Object

- initWithContentsOfURL:ofType:error:

Initializes a document located by a URL of a specified type.

- initForURL:withContentsOfURL:ofType:error:

Initializes a document with the specified contents, and places the resulting document's file at the designated location.

- initWithType:error:

Initializes a document of a specified type.