RequestRetrier - SwiftDocOrg/Alamofire GitHub Wiki
RequestRetrier
A type that determines whether a request should be retried after being executed by the specified session manager and encountering an error.
public protocol RequestRetrier
Requirements
retry(_:for:dueTo:completion:)
Determines whether the Request should be retried by calling the completion closure.
func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -> Void)
This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs to be retried. The one requirement is that the completion closure is called to ensure the request is properly cleaned up after.
Parameters
- request:
Requestthat failed due to the providedError. - session:
Sessionthat produced theRequest. - error:
Errorencountered while executing theRequest. - completion: Completion closure to be executed when a retry decision has been determined.