Slide 28
Slide 28 text
Before
func fetchUser(for id: User.ID, completion: @escaping (Result) -> Void) {
let url: URL = .init(string: "https://koherent.org/fake-service/api/user?id=\(id)")!
downloadData(from: url) { result in
let data = try result.get()
let user = try JSONDecoder().decode(User.self, from: data)
completion(.success(user))
}
}