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
RequestNetworking
to 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
completion
from a background thread.Warning
Implementations must guarante that they will call thecompletion
closure exactly once.Declaration
Swift
func startRequest( _ request: URLRequest, completion: @escaping RequestNetworkingCompletionCallback) -> RequestNetworking
-
siestaNetworkingProvider
Extension methodYou can pass a
NetworkingProvider
when creating aService
to override the default networking behavior.See also
NetworkingProviderConvertibleDeclaration
Swift
public var siestaNetworkingProvider: NetworkingProvider { get }