Skip to content

Instantly share code, notes, and snippets.

@elkraneo
Created October 23, 2016 10:04
Show Gist options
  • Save elkraneo/1d6c09abce6cc2b5bc81afda37ca92b4 to your computer and use it in GitHub Desktop.
Save elkraneo/1d6c09abce6cc2b5bc81afda37ca92b4 to your computer and use it in GitHub Desktop.
let json = try JSON(data: response)
let movies: [Movie]?
switch json {
case let .array(jsonModels):
let moviesDict = try jsonModels.map { try JSON($0.getDictionary(at: "movie")) }
movies = try moviesDict.map(Movie.init)
default:
movies = nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment