         
         do {
             try audioEngine.start()
+            textView.text = "Listening..."
         } catch {
             print("Audio engine failed to start")
         }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        textView.text = "Listening..."
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        speechRecognizer?.delegate = self
        startListening()
    }
    
    func startListening() {
        if recognitionTask != nil {
            recognitionTask?.cancel()
            recognitionTask = nil
        }
        
        recognitionRequest = SFSpeechAudioBufferRecognitionRequest()
        guard let recognitionRequest = recognitionRequest else {
            return

            let alertController = UIAlertController(title: nil,
                                                    message: "Speech Recognition is currently unavailable.",
                                                    preferredStyle: .alert)
            let alertAction = UIAlertAction(title: "OK", style: .default) { (alertAction) in
                self.cancelButtonTapped()
            }
            alertController.addAction(alertAction)
            present(alertController, animated: true)
        }
    }
}
