title: How to run operations in background while an iOS application is in foreground
body: <p>I have a JSON file populated with strings data in Documents Directory. In user Interface of application there is a UIButton. On button press, a new string appends into the JSON file.</p>
  
  <p>Now I am looking for any iOS Service that helps me to send these strings (from JSON file) to the server using swift. And this service should be totally independent of my code.
  The point is when I press a UIButton, the first step is a string is saved to the JSON file then service should take this string and send it to server if Internet is available.</p>
  
  <p>When a string sent successfully, it should be removed from the JSON file.
  This service should track after every 30 seconds if there is any string saved into JSON file, then send it to server.</p>
  
  <p>I Googled and found <a href="https://possiblemobile.com/2013/09/ios-7-background-fetch/" rel="noreferrer">background fetch</a> but It triggers <code>performFetchWithCompletionHandler</code> function automatically and I cannot know when iOS triggers it. I want to trigger this kind of service my self after every 30 seconds.</p>