Contents

init(type:)

Initializes a document of a specified type.

Declaration

convenience init(type typeName: String) throws

Parameters

  • typeName:

    The string that identifies the document type.

Return Value

The initialized NSDocument object, or, if the document could not be created, nil.

Discussion

The default implementation of this method just invokes [self init] and [self setFileType:typeName].

You can override this method to perform initialization that must be done when creating new documents but should not be done when opening existing documents. Your override should typically invoke super, or at least it must invoke init(), the NSDocument designated initializer, to initialize the NSDocument private instance variables.

See Also

Creating a Document Object