My UITableViewController, when initially viewed does not contain any data. However once, I go to another UIViewController, the data appears while the segue is still animating, and then the data is there. So to actually see the data, I need to go to another ViewController, and then back to the UITableViewController. I am using the Parse.com framework. The following code, is of the initial ViewController, which is also a UITableViewController that segues the the UITableViewController that does not contain any data initially. Thanks for the help, I am a newbie at IOS development, so please make answers in swift.
EDIT:Many of the answers or comments assume that the data is retrieved, and is just not loading unto the UITableViewController. However the problem is the fact that the data has not been retrieved by the time the segue has been completed. Thanks
override func prepareForSegue(segue: UIStoryboardSegue, sender:AnyObject?){
var cell = sender as UITableViewCell
var text = cell.textLabel!.text
currentScreen=text!
println(currentScreen)
groupConversation=[]
var messageDisplayOne = PFQuery(className:currentScreen)
messageDisplayOne.selectKeys(["userPost"])
messageDisplayOne.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil{
println("Type message \(groupConversation)")
for object in objects {
var textObject = object["userPost"] as String
groupConversation.append(textObject)
}
} else {
// Log details of the failure
}
}
}
tableview.reloadDatain swift?UITableViewControllerappears.