     @IBOutlet weak var textField: NSTextField!
     @IBOutlet weak var speakButton: NSButton!
     @IBOutlet weak var stopButton: NSButton!
+    
+    let speechSynth = NSSpeechSynthesizer()
+    
+    /**didSet and willSet are observers that you can declare as part of a stored property. Implementing observers allows you to respond to the property’s value being changed.
+     */
+    
+    var isStarted: Bool = false {
+        didSet {
+            updateButtons()
+        }
+    }
 
     override func windowDidLoad() {
         super.windowDidLoad()
+        self.updateButtons()
+        speechSynth.delegate = self
 
     }
     

        if string.isEmpty {
            print("stirng from \(textField!) is empty")
        } else {
            print("string is \"\(textField.stringValue)\"")
        }
    }
    
    @IBAction func stopIt(sender: NSButton) {
        print("stop button clicked")
    }
    
}


import Cocoa

class MainWindowController: NSWindowController, NSSpeechSynthesizerDelegate {
    override var windowNibName: String {
        return "MainWindowController"
    }
