Skip to content

Instantly share code, notes, and snippets.

@dmytro-anokhin
Created December 10, 2019 20:55
Show Gist options
  • Save dmytro-anokhin/4987f25af807edacc3b1b439628bdbe7 to your computer and use it in GitHub Desktop.
Save dmytro-anokhin/4987f25af807edacc3b1b439628bdbe7 to your computer and use it in GitHub Desktop.
protocol UserNetworkService {
func loadUsers(withURL url: URL, completion: @escaping (Result<[User], Error>) -> Void)
}
class UserService {
let networkService: UserNetworkService
init(networkService: UserNetworkService) {
self.networkService = networkService
}
func getUser(withId userId: Int, completion: @escaping (User?) -> Void) {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment