Netable
open class Netable
extension Netable: Equatable
Undocumented
-
The base URL of your api endpoint.
Declaration
Swift
public var baseURL: URL -
Headers to be sent with each request.
Declaration
Swift
public var headers: [String : String] -
Destination that logs will be printed to during network requests.
Declaration
Swift
public var logDestination: LogDestination -
Create a new instance of
Netablewith a base URL.Declaration
Swift
public init(baseURL: URL, configuration: URLSessionConfiguration = .ephemeral, logDestination: LogDestination = DefaultLogDestination())Parameters
baseURLThe base URL of your endpoint.
configurationConfiguration such as timeouts and caching policies for the underlying url session.
-
Create and send a new request.
Declaration
Swift
@discardableResult public func request<T>(_ request: T, completion unsafeCompletion: @escaping (Result<T.FinalResource, NetableError>) -> Void) -> RequestIdentifier where T : RequestParameters
requestThe request to send, this has to extend
Request.completionYour completion handler for the request.
-
Cancel a specific ongoing request.
Declaration
Swift
open func cancel(byId taskId: RequestIdentifier)Parameters
requestThe request to cancel.
-
Cancel any ongoing requests.
Declaration
Swift
open func cancelAllTasks() -
Declaration
Swift
public static func == (lhs: Netable, rhs: Netable) -> Bool
Netable Class Reference