func checkMicrophoneAccess() { switch AVAudioSession.sharedInstance().recordPermission { case .granted: print("📹 Mic enabled 👍") case .denied: print("📹 Mic does not have permission 👎") presentMicrophoneSettings() case .undetermined: AVAudioSession.sharedInstance().requestRecordPermission({ granted in print("Mic enabled \(granted == true ? "YES" : "NO")") }) default: break } } func presentMicrophoneSettings() { let alertController = UIAlertController(title: NSLocalizedString("common_alert_title_warning", comment: ""), message: NSLocalizedString("toast_error_permission_camera", comment: ""), preferredStyle: .alert) alertController.addAction(UIAlertAction(title: NSLocalizedString("application_settings_title", comment: ""), style: .default) { _ in guard let url = URL(string: UIApplication.openSettingsURLString) else { return } UIApplication.shared.open(url, options: [:], completionHandler: nil) }) alertController.addAction(UIAlertAction(title: NSLocalizedString("common_button_cancel", comment: ""), style: .destructive)) present(alertController, animated: true) }