NetworkingProvider
public protocol NetworkingProvider : NetworkingProviderConvertible
If you want to use a different networking library, implement this protocol and pass your implementation to
Service.init(...).
See URLSessionProvider and Extensions/Alamofire/Networking-Alamofire.swift for implementation examples.
-
Start the given request asynchronously, and return a
RequestNetworkingto control the request.If the request is cancelled, call the response closure with an error.
Note
This method will be called on the main thread. It is the implementation’s responsibility to ensure that network requests run asynchronously.
Implementations may call the
completionfrom a background thread.Warning
Implementations must guarante that they will call thecompletionclosure exactly once.Declaration
Swift
func startRequest( _ request: URLRequest, completion: @escaping RequestNetworkingCompletionCallback) -> RequestNetworking -
siestaNetworkingProviderExtension methodYou can pass a
NetworkingProviderwhen creating aServiceto override the default networking behavior.See also
NetworkingProviderConvertibleDeclaration
Swift
public var siestaNetworkingProvider: NetworkingProvider { get }
View on GitHub
NetworkingProvider Protocol Reference