Slide 13
Slide 13 text
let handler: (RequestResult) -> Void = {
response in
switch(response) {
case .Error(let error):
callback(.Error(error))
case .Result(let json):
var shows = [APIShow]()
if let dicts = json.array {
for dict in dicts {
shows += APIShow(json: dict)
}
}
callback(.Result(shows))
}
}
sendRequest(request, completion: handler)