// // AppDelegate.swift // writeas // // Created by Matt Baer on 12/29/15. // Copyright © 2015 A Bunch Tell. All rights reserved. // import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { var vc: ViewController? func applicationDidFinishLaunching(aNotification: NSNotification) { // Insert code here to initialize your application } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } func applicationDidBecomeActive(_ notification: Notification) { if vc == nil { vc = NSApplication.shared().mainWindow?.contentViewController as! ViewController } } @IBAction func saveDocument(_ sender: AnyObject) { vc?.saveDocument() } }