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 the completion closure exactly once.

    Declaration

    Swift

    func startRequest(
            _ request: URLRequest,
            completion: @escaping RequestNetworkingCompletionCallback)
        -> RequestNetworking
  • siestaNetworkingProvider Extension method

    You can pass a NetworkingProvider when creating a Service to override the default networking behavior.

    See also

    NetworkingProviderConvertible

    Declaration

    Swift

    public var siestaNetworkingProvider: NetworkingProvider { get }