Created
October 23, 2016 10:04
-
-
Save elkraneo/1d6c09abce6cc2b5bc81afda37ca92b4 to your computer and use it in GitHub Desktop.
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
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