ios - Alamofire with append won't show data -
i want append data in code here below. gives me empty array why? because used framework?
class func getdatabyjson() -> array<string> { let urldb = "https://dl.dropboxusercontent.com/u/13259946/voorbeeld.json" //werkt! var data: array<string> = [] alamofire.request(.get, urldb) .responsejson { (request, response, json, error) in //println(error) if let groups : anyobject! = json { var group = groups["groups"] nsarray g in group { data.append(g["name"] nsstring) //println(data) } //println(data) } println(data) //return data } return data }
alamofire asynchronously. instead of having getdatabyjson
return array of strings, have accept additional completionhandler
parameter executes response data when request finishes.
Comments
Post a Comment