From a1e9262e20d3dfe24dc386533e27d3ecbcbb8eab Mon Sep 17 00:00:00 2001 From: Joan Molinas Ramon Date: Thu, 11 Aug 2016 16:20:43 +0200 Subject: [PATCH] improve a bit code --- Siri/ViewController.swift | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Siri/ViewController.swift b/Siri/ViewController.swift index 406cbe7..9becc30 100755 --- a/Siri/ViewController.swift +++ b/Siri/ViewController.swift @@ -36,15 +36,12 @@ class ViewController: UIViewController, SFSpeechRecognizerDelegate { isButtonEnabled = true case .denied: - isButtonEnabled = false print("User denied access to speech recognition") case .restricted: - isButtonEnabled = false print("Speech recognition restricted on this device") case .notDetermined: - isButtonEnabled = false print("Speech recognition not yet authorized") } @@ -133,11 +130,7 @@ class ViewController: UIViewController, SFSpeechRecognizerDelegate { } func speechRecognizer(_ speechRecognizer: SFSpeechRecognizer, availabilityDidChange available: Bool) { - if available { - microphoneButton.isEnabled = true - } else { - microphoneButton.isEnabled = false - } + microphoneButton.isEnabled = available } }