WriteFreely Documentation Beta

Protocol URLSession​Protocol

public protocol URLSessionProtocol 

Define requirements for URLSessions here for dependency-injection purposes (specifically, for testing).

Requirements

Data​Task​Result

typealias DataTaskResult = (Data?, URLResponse?, Error?) -> Void

data​Task(with:​completion​Handler:​)

func dataTask(with request: URLRequest, completionHandler: @escaping DataTaskResult) -> URLSessionDataTaskProtocol