diff --git a/writeas/AppDelegate.swift b/writeas/AppDelegate.swift
index 296b6c3..7410c55 100644
--- a/writeas/AppDelegate.swift
+++ b/writeas/AppDelegate.swift
@@ -11,16 +11,24 @@ import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
-
+ var vc: ViewController?
func applicationDidFinishLaunching(aNotification: NSNotification) {
// Insert code here to initialize your application
}
- func applicationWillTerminate(aNotification: NSNotification) {
+ 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()
+ }
}
diff --git a/writeas/Base.lproj/Main.storyboard b/writeas/Base.lproj/Main.storyboard
index 53267b8..daba7e1 100644
--- a/writeas/Base.lproj/Main.storyboard
+++ b/writeas/Base.lproj/Main.storyboard
@@ -82,14 +82,9 @@
-