Skip to content

Instantly share code, notes, and snippets.

@burakekmen
Created December 3, 2025 08:28
Show Gist options
  • Select an option

  • Save burakekmen/808d877172f0d8a2d752e3cb81d8e895 to your computer and use it in GitHub Desktop.

Select an option

Save burakekmen/808d877172f0d8a2d752e3cb81d8e895 to your computer and use it in GitHub Desktop.
func requestPermissions(completion: @escaping (Bool) -> Void) {
// 1. Request Speech Authorization
SFSpeechRecognizer.requestAuthorization { [weak self] authStatus in
guard authStatus == .authorized else {
completion(false)
return
}
// 2. Request Microphone Authorization
AVAudioSession.sharedInstance().requestRecordPermission { granted in
completion(granted)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment