} class ApiClient: ApiClientProtocol { func fetchAll(completion: @escaping ((Result<[Todo], Error>) -> Void)) { // ... build URL URLSession.shared.dataTask(with: url) { (data, _, error) in guard let data = data else { completion(.failure(error!)) return } let todos = try! JSONDecoder().decode([Todo].self, from: data) completion(.success(todos)) }.resume() } }