Created
July 3, 2017 14:19
-
-
Save malcolmkmd/17b844f91039381c2ae722741b969673 to your computer and use it in GitHub Desktop.
Movie Model
This file contains 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
import Foundation | |
struct APIResults: Decodable { | |
let page: Int | |
let numResults: Int | |
let numPages: Int | |
let movies: [Movie] | |
private enum CodingKeys: String, CodingKey { | |
case page, numResults = "total_results", numPages = "total_pages", movies = "results" | |
} | |
} | |
struct Movie: Decodable { | |
let id:Int! | |
let posterPath: String | |
var videoPath: String? | |
let backdrop: String | |
let title: String | |
var releaseDate: String | |
var rating: Double | |
let overview: String | |
private enum CodingKeys: String, CodingKey { | |
case id, posterPath = "poster_path", videoPath, backdrop = "backdrop_path", title, releaseDate = "release_date", rating = "vote_average", overview | |
} | |
} | |
struct VideoResults: Decodable { | |
let details: [VideoKey] | |
private enum CodingKeys: String, CodingKey { | |
case details = "results" | |
} | |
} | |
struct VideoKey: Decodable { | |
let key: String | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment