title: how to store pending notifications in an array in swift
body: <p>I am trying to program a function which returns all the identifiers of pending notifications, which are repeating.</p>
  <pre><code>func getRepeatingNotificationsIds () -&gt; [String] {
      
      var repatingNotification:[String] = []
      UNUserNotificationCenter.current().getPendingNotificationRequests {
          (requests)  in
          for request in requests{
              if (request.trigger?.repeats == true)
              {
                  repatingNotification.append(request.identifier)
              }
              
           }
      }
      
      return repatingNotification
      
  }
  </code></pre>
  <p>However the repatingNotification array remains empty when returned. Is it possible to maybe call repatingNotification by reference or something?</p>