Skip to content

Instantly share code, notes, and snippets.

@mazz
Created May 21, 2017 03:35
Show Gist options
  • Select an option

  • Save mazz/86abd089b2f7a1c7a01f4669126eb988 to your computer and use it in GitHub Desktop.

Select an option

Save mazz/86abd089b2f7a1c7a01f4669126eb988 to your computer and use it in GitHub Desktop.
let session = URLSession.shared
let task = session.dataTask(with: request as URLRequest, completionHandler: {(data, response, error) in
if (error == nil) {
do {
let json = try! JSONSerialization.jsonObject(with: data!, options: [])
let books = Mapper<BookResponse>.mapArray(json) // ERROR: Argument labels '(_:)' do not match any available overloads
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
print(jsonResult)
DispatchQueue.main.async {
success(jsonResult)}
}
}
}
});
task.resume()
@hammadzz
Copy link
Copy Markdown

let books = Mapper<BookResponse>().mapArray(json)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment