Append object to array in Swift 3
<p>Having a bit of trouble trying to push objects that I query from Parse into an array that I can use in a UITableView.</p>

<p>Here's my code.</p>

<pre><code>var locations = [AnyObject]()

override func viewDidLoad() {
    super.viewDidLoad()

    // Query the Locations class.
    let query = PFQuery(className:"Location")

    query.findObjectsInBackground {
        (objects: [PFObject]?, error: Error?) -&gt; Void in
        if error == nil {
            if let objects = objects {
                for object in objects {
                    self.locations.append(object)
                }
                self.venueTable.reloadData()
            }
        } else {
            // Log details of the failure
            print("Error: (error!) (error!.userInfo)")
        }
    }

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {

    return locations.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {

    let locationCell = tableView.dequeueReusableCell(withIdentifier: "locationCell", for: indexPath)

    let location = locations[indexPath.row]

    locationCell.textLabel?.text = location

    return locationCell
}
</code></pre>

<p>After the for loop, locations is full of the parse data, but not sure how to access it when pushing it to the <code>locationCell</code></p>