title: Run AVCaptureDevice.requestAccess blocking
body: <p>In my app I want to ask for camera access when the user pressed a camera button, which would take him to an AVFoundation based camera live preview.</p>
  
  <p>That view is presented using a "present modally segue".</p>
  
  <p>So in my ViewController I currently override the <code>shouldPerformSegue()</code> and return true if the user gives permission or has granted it already, otherwise false.</p>
  
  <p>If the user didn't grant access I am showing an Alert in which he can go to settings to change the permission. That is done in <code>showPermissionInfo()</code>.</p>
  
  <p>My problem is, that <code>AVCaptureDevice.requestAccess</code> is called asynchronously and thus <code>hasCameraPermission</code> is not set to true before I'm checking for it.
  Is there a way to call these restriction accesses in a blocking way?
  Thank you!</p>
  
  <pre><code>override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -&gt; Bool {
  
      if identifier == "Modally_ToCameraViewController"
      {
          var hasCameraPermission = false
  
          if AVCaptureDevice.authorizationStatus(for: .video) ==  .authorized
          {
              hasCameraPermission = true
          } else {
              AVCaptureDevice.requestAccess(for: .video, completionHandler: { (granted: Bool) in
                  if granted {
                      hasCameraPermission = true
                  } else {
                      hasCameraPermission = false
                  }
              })
          }
  
  
          if(!hasCameraPermission){
              showPermissionInfo()
          }
  
       return hasCameraPermission
      }
  
          return true
  
  }
  </code></pre>