 <p>The code with completion block should like this:</p> <pre><code>func getSectionsFromData(completion: ([Sections]? -&gt; Void)){ var sectionsArray = [Sections]() let animals = Sections(title: "Animals", objects: ["Cats", "Dogs", "Birds", "Lions"]) Alamofire.request(.GET, url).validate().responseJSON { response in switch response.result { case .Success: if let value = response.result.value { let json = JSON(value) for (_, subJson) in json { for (_, data) in subJson { for (title, objects) in data { sectionsArray.append(Sections(title: title, objects: objects.self.arrayValue.map { $0.string!})) } } } } sectionsArray.append(animals) completion(sectionsArry) case .Failure(let error): print(error) sectionsArray.append(animals) completion(nil) } } } </code></pre> <p>When you call the func:</p> <pre><code>var sections: [Sections] = [] SectionsData().getSectionsFromData({ sectionsArray in self.sections = sectionsArray //reload your table with sectionsArray }) </code></pre>