Skip to content

Instantly share code, notes, and snippets.

View PetreVane's full-sized avatar
🍃

Petre Vane PetreVane

🍃
View GitHub Profile
@PetreVane
PetreVane / TaskManager.swift
Created February 27, 2019 17:13 — forked from saoudrizwan/TaskManager.swift
Handle multiple network requests with the same URL efficiently with a shared task manager
import Foundation
class TaskManager {
static let shared = TaskManager()
let session = URLSession(configuration: .default)
typealias completionHandler = (Data?, URLResponse?, Error?) -> Void
var tasks = [URL: [completionHandler]]()