Instance Method

read(from:ofType:)

Sets the contents of this document by reading from a file wrapper of a specified type.

Declaration

func read(from fileWrapper: FileWrapper, ofType typeName: String) throws

Parameters

fileWrapper

The file wrapper from which the document contents are read.

typeName

The string that identifies the document type.

outError

On return, if the document contents could not be read, a pointer to an error object that encapsulates the reason they could not be read.

Return Value

true if the document contents could be read; otherwise, false.

Discussion

The default implementation of this method invokes [self readFromData:[fileWrapper regularFileContents] ofType:typeName error:outError].

For backward binary compatibility with OS X v10.3 and earlier, the default implementation of this method instead invokes [self loadFileWrapperRepresentation:fileWrapper ofType:typeName] if loadFileWrapperRepresentation:ofType: is overridden.

See Also

Reading the Document's Content

class func canConcurrentlyReadDocuments(ofType: String) -> Bool

Returns a Boolean value that indicates whether the receiver reads multiple documents of the given type concurrently.

func read(from: URL, ofType: String)

Sets the contents of this document by reading from a file or file package, of a specified type, located by a URL.

func read(from: Data, ofType: String)

Sets the contents of this document by reading from data of a specified type.