The following is the function that loadData()
//**********************************
func r_feedback(rtaskId: String) {
var singleFeed = myFeedback()
self.arrayOfFeedback.removeAll()
queryFeedback(taskId: rtaskId).findObjectsInBackground { (objects, error) in
if let objects = objects {
if (objects.count 0) {
for eachFeed in objects {
singleFeed.feedDate = eachFeed.createdAt!
singleFeed.userNameFrom = eachFeed["UserNameFrom"] as? String
singleFeed.feedMessage = eachFeed["TaskFeedback"] as? String
singleFeed.atype = eachFeed["AType"] as? Int
self.arrayOfFeedback.append(singleFeed)
}
} else {
singleFeed.feedDate = nil
singleFeed.userNameFrom = ""
singleFeed.feedMessage = ""
singleFeed.atype = nil
}
self.fTableView.reloadData()
}
}
}
//**********************************
In turn funcion r_feedback(rtaskId: String) calls function queryFeedback() that fetches data in background and appends my array arrayOfFeedback and at the end calls TableView.reloadData(). I am using Parse Server as backend.
I just want to clarifies that if I use an additional viewController with textField to add messages, because this other viewController is called on top of the viewController that displays all the messages, it works but because I do not prefer to go have additional viewController but instead use the same viewController to update the messages, that's when I have this behavior
Topic:
App & System Services
SubTopic:
Core OS
Tags: