I'm new to macOS programming. In a macOS document based application I have create to learn, I'm having trouble implementing openDocument(withContentsOf:display:completionHandler:) to open a file document.
Would anyone be so kind to give me an example of use?
The code I've written so far is:
import Cocoa
class DocumentController: NSDocumentController {
func openDoc() {
let directoryURL = FileManager.default.urls(for: ..applicationSupportDirectory, in: .userDomainMask).first
let docURL = URL(string:"SampleFile.doctest", relativeTo:directoryURL)
openDocument(withContentsOf: docURL!, display: true, completionHandler: {(NSDocument, Bool, Error) in
// incomplete
}
}