This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Foundation | |
protocol Disposable { | |
func dispose() | |
} | |
final class Disposer: Disposable { | |
private var disposer: (() -> Void)? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import PlaygroundSupport | |
enum Result<Value> { | |
case success(Value) | |
case failure(Error) | |
} | |
func data(at url: URL, completion: @escaping (Result<Data>) -> Void) { | |
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { |