mas/Sources/MasKit/Network/URLSession+NetworkSession.swift

19 lines
443 B
Swift
Raw Normal View History

//
// URLSession+NetworkSession.swift
// MasKit
//
// Created by Ben Chatelain on 1/5/19.
// Copyright © 2019 mas-cli. All rights reserved.
//
import Foundation
extension URLSession: NetworkSession {
open func loadData(from url: URL, completionHandler: @escaping (Data?, Error?) -> Void) {
2019-01-30 06:15:24 +00:00
let task = dataTask(with: url) { data, _, error in
completionHandler(data, error)
}
task.resume()
}
}