enum ReadResult{
case Successful
case Failed
case Pending
}
struct OutpuData {
var data = Data()
var result: ReadResult
var error: Error?
}
func readData(from url: String, completion: @escaping (OutpuData) -> Void) {
var _data = OutpuData(data: Data(), ...