Skip to content

Instantly share code, notes, and snippets.

@ertembiyik
Last active May 31, 2022 18:47
Show Gist options
  • Save ertembiyik/e4fc0374714f56f06c01cfb02eea75ec to your computer and use it in GitHub Desktop.
Save ertembiyik/e4fc0374714f56f06c01cfb02eea75ec to your computer and use it in GitHub Desktop.
static func searchBy(id: Int, completion: @escaping(Character?, Error?) -> ()) {
manager.sendRequest(route: Self.id(id), decodeTo: Character.self) { completion($0, $1)}
}
static func searchWith(filters: [Filters], completion: @escaping([Character]?, Error?) -> ()) {
struct SearchWithFiltersResponse: Decodable {
let info: Info
let results: [Character]
}
manager.sendRequest(route: Self.base(filters), decodeTo: SearchWithFiltersResponse.self) { completion($0?.results, $1)}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment