We encountered connection problems with our internal applications, so we wrote a Swift structure that allows you to perform any network operations and send them whenever the device has Internet access - https://cocoapods.org/pods/OfflineRequestManager . You still have to process the network request on its own in the object corresponding to OfflineRequest, but it sounds like it is suitable for your use case.
The simplest example of use will look something like this: although most actual cases (saving to disk, specific request data, etc.) will have a few more hoops:
import OfflineRequestManager class SimpleRequest: OfflineRequest { func perform(completion: @escaping (Error?) -> Void) { doMyNetworkRequest(withCompletion: { response, error in handleResponse(response) completion(error) }) } }
source share