mirror of
https://github.com/mas-cli/mas
synced 2025-01-03 07:38:42 +00:00
19 lines
440 B
Swift
19 lines
440 B
Swift
|
//
|
||
|
// URLSession+NetworkSession.swift
|
||
|
// MasKit
|
||
|
//
|
||
|
// Created by Ben Chatelain on 1/5/19.
|
||
|
// Copyright © 2019 mas-cli. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
extension URLSession: NetworkSession {
|
||
|
func loadData(from url: URL, completionHandler: @escaping (Data?, Error?) -> Void) {
|
||
|
let task = dataTask(with: url) { (data, _, error) in
|
||
|
completionHandler(data, error)
|
||
|
}
|
||
|
task.resume()
|
||
|
}
|
||
|
}
|