how to execute functions on swift when app is closed?

I need to send pushNotifications for the user if he's inside a certain area the problem is these areas changes over time and I need to fetch data to set the new geoFences but I need this to work even though the app is closed...

where should I fetch the data and send the notification to be able to notify the user?

how message apps like whatsapp, telegram for exemple are able to send push notifications before the app is running?

I'm searching for options on the internet but I haven't got much so far..

thank you in advance for the answers.

1 answer