Skip to content

Instantly share code, notes, and snippets.

@SunXiaoShan
Created February 8, 2018 04:56
Show Gist options
  • Save SunXiaoShan/9e2c03dd24f5c3adcaa5edea29514969 to your computer and use it in GitHub Desktop.
Save SunXiaoShan/9e2c03dd24f5c3adcaa5edea29514969 to your computer and use it in GitHub Desktop.
VoiceRecognition
SFSpeechRecognizer.requestAuthorization { [weak self] (authStatus) in
var isAuthorization = false
switch authStatus {
case .authorized:
isAuthorization = true
case .denied:
isAuthorization = false
print("User denied access to speech recognition")
case .restricted:
isAuthorization = false
print("Speech recognition restricted on this device")
case .notDetermined:
isAuthorization = false
print("Speech recognition not yet authorized")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment