title: swift - how to return from a within a completion handler closure of a system function?
body: <p>I know this can't work because the <code>completion handler</code> is on a <code>background Thread</code> but </p>
  
  <blockquote>
    <p>where am I supposed do dispatch the main queue or what else do i have
    to do?</p>
  </blockquote>
  
  <p>this is the code:</p>
  
  <pre><code>static func isNotificationNotDetermined() -&gt; Bool{
  
      var isNotDetermined = false
  
      UNUserNotificationCenter.current().getNotificationSettings { (notificationSettings) in
          switch notificationSettings.authorizationStatus {
          case .notDetermined:
              isNotDetermined = true
  
          case .authorized:
              isNotDetermined = false
  
          case .denied:
              isNotDetermined = false
  
          }
      }
  
      return isNotDetermined
  }
  </code></pre>