currentDocument
The document object associated with the main window.
Declaration
var currentDocument: NSDocument? { get }Discussion
The value of this property is nil if it is called when the app is not active. This can occur during processing of a drag-and-drop operation, for example, in an implementation of readSelectionFromPasteboard:. In such a case, send the following message instead from an NSView subclass associated with the document:
[[[self window] windowController] document];