Document.swift 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // Document.swift
  3. // MacTerminal
  4. //
  5. // Created by Miguel de Icaza on 3/11/20.
  6. // Copyright © 2020 Miguel de Icaza. All rights reserved.
  7. //
  8. import Cocoa
  9. class Document: NSDocument {
  10. override init() {
  11. super.init()
  12. // Add your subclass-specific initialization here.
  13. }
  14. //override class var autosavesInPlace: Bool {
  15. // return true
  16. //}
  17. override func makeWindowControllers() {
  18. // Returns the Storyboard that contains your Document window.
  19. let storyboard = NSStoryboard(name: NSStoryboard.Name("Main"), bundle: nil)
  20. let windowController = storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier("Document Window Controller")) as! NSWindowController
  21. self.addWindowController(windowController)
  22. }
  23. override func data(ofType typeName: String) throws -> Data {
  24. // Insert code here to write your document to data of the specified type, throwing an error in case of failure.
  25. // Alternatively, you could remove this method and override fileWrapper(ofType:), write(to:ofType:), or write(to:ofType:for:originalContentsURL:) instead.
  26. throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
  27. }
  28. //override func read(from data: Data, ofType typeName: String) throws {
  29. // // Insert code here to read your document from the given data of the specified type, throwing an error in case of failure.
  30. // // Alternatively, you could remove this method and override read(from:ofType:) instead.
  31. // // If you do, you should also override isEntireFileLoaded to return false if the contents are lazily loaded.
  32. // throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
  33. //}
  34. }