Skip to content

Instantly share code, notes, and snippets.

@thepearl
Last active January 14, 2021 15:11
Show Gist options
  • Save thepearl/11eb569feee5253fbbbac2e5e07dfc32 to your computer and use it in GitHub Desktop.
Save thepearl/11eb569feee5253fbbbac2e5e07dfc32 to your computer and use it in GitHub Desktop.
IMDB API response
// 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