Network Layer
-
If you want to use a different networking library, implement this protocol and pass your implementation to
Service.init(...).See
See moreURLSessionProviderandExtensions/Alamofire/Networking-Alamofire.swiftfor implementation examples.Declaration
Swift
public protocol NetworkingProvider : NetworkingProviderConvertible -
A convenience to turn create the appropriate
NetworkingProviderfor a variety of networking configuration objects. Used by theServiceinitializer.For example, instead of having to do this:
Service(baseURL: "http://foo.bar", networking: URLSessionProvider(session: URLSession(configuration: URLSessionConfiguration.default)))…you can do this:
Service(baseURL: "http://foo.bar", networking: URLSessionConfiguration.default)Siesta supports conversion of the following types into a networking provider:
- URLSession
- URLSessionConfiguration
- Alamofire.Manager
…and you can add to the list by writing an extension to implement
See moreNetworkingProviderConvertible.Declaration
Swift
public protocol NetworkingProviderConvertible -
Network handling for a single request. Created by a
NetworkingProvider. Implementations have three responsibilities:- start the request on creation,
- call the closure passed to
NetworkingProvider.startRequest(...)when the request is complete, and - optionally support cancelling requests in progress.
Declaration
Swift
public protocol RequestNetworking -
Used by a
NetworkingProviderimplementation to pass the result of a network request back to Siesta.Declaration
Swift
public typealias RequestNetworkingCompletionCallback = (HTTPURLResponse?, Data?, Error?) -> Void -
Used by
See moreNetworkingProviderimplementations to report request progress.Declaration
Swift
public struct RequestTransferMetrics -
Uses
URLSessionDataTaskfor Siesta networking.This is Siesta’s default networking provider.
See moreDeclaration
Swift
public struct URLSessionProvider : NetworkingProvider -
Convenience for
See moreNetworkingProviderimplementations that ultimate rely on aURLSessionTask.Declaration
Swift
public protocol SessionTaskContainer
View on GitHub
Network Layer Reference