As we can get Current Progress from URLSession.shared.dataTask. is there any method to get progress in apollo fetch for ios.
I need to show a progressview, until the response recived and update the progress of progress view on the basis of how much data is received.
There isn’t anything specific in the apollo-ios
library around the progress. You typically would just handle the results from apollo.fetch
:
apollo.fetch(query: HeroNameQuery()) { result in
switch result {
case .success(let graphQLResult):
if let name = graphQLResult.data?.hero?.name {
print(name) // Luke Skywalker
} else if let errors = graphQLResult.errors {
// GraphQL errors
print(errors)
}
case .failure(let error):
// Network or response format errors
print(error)
}
}