First post here so apologies in advance for any guidelines I might break inadvertently.
I have a simple monitor app which downloads a json dataset to populate a table.
By pulling down, I can manually trigger a refresh which calls the download function.
What I am trying to achieve is automatic download every 10 minutes but failing miserably!
I have tried two methods:
1) using a timer with .onreceive on the view to call my download function
2) using a timer to directly call the download function
The error I hit is that the onreceive and the timer are expecting synchronous functions but my download function is async.
I would be really grateful if anyone could give me some pointers regarding wrapping my async download function so it can be called from the .onreceive of the view.
Alternatively a pointer towards a pattern for implementing automatic period downloads.
Many thanks!