I am writing a SwiftData/SwiftUI app in which the user saves simple records, tagged with their current location. Core Location can take up to 10 seconds to retrieve the current location from its requestLocation()
call.
I the main app I have wrapped the CLLocationManager
calls with async implementations. I kick off a Task
when a new record is created, and write the location to my @Model
on the main thread when it completes.
A realistic use of the share extension doesn't give the task enough time to complete.
I can use performExpiringActivity
to complete background processing after the share extension closes but this needs to be a synchronous block. Is there some way of using performExpiringActivity
when relying on a delegate callback from something like Core Location?