Last active
January 14, 2021 15:11
-
-
Save thepearl/11eb569feee5253fbbbac2e5e07dfc32 to your computer and use it in GitHub Desktop.
IMDB API response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MARK: - Response | |
struct Response: Decodable, Hashable { | |
let searchType, expression: String? | |
let results: [Result]? | |
let errorMessage: String? | |
} | |
// MARK: - Result | |
struct Result: Decodable, Hashable { | |
func hash(into hasher: inout Hasher) { | |
hasher.combine(id) | |
} | |
public static func == (lhs: Result, rhs: Result) -> Bool { | |
return lhs.id == rhs.id | |
} | |
let id, resultType: String? | |
let image: String? | |
let title, resultDescription: String? | |
enum CodingKeys: String, CodingKey { | |
case id, resultType, image, title | |
case resultDescription = "description" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment