URLSession

extension URLSession: NetworkAccess

Adds conformens to NetworkAccess. URLSession can be used as a network access.

  • Fetches a request asynchrony from remote location.

    Declaration

    Swift

    public func load(request: URLRequest, callback: @escaping (Data?, HTTPURLResponse?, Error?) -> Void) -> NetworkTask

    Parameters

    request

    The request you want to fetch.

    callback

    Callback which gets called when the request finishes.

    Return Value

    the running network task