I am building a single viewcontroller app using UITableViewController in Swift 2.
The problem I am having here is if I load data inside viewDidLoad function, the UITableView displays well with the data.
However, I am trying to have get this data from a custom delegate method, which is called after the data is saved into core data, then self.tableview.reloadData() the UITableView won't display the data.
From my debugging, looks like the
override func numberOfSectionsInTableView(tableView: UITableView) -> Int
and
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
run before my custom delegate method
func didReceiveQualifications(qualifications: [Qualification]) {
print("didReceivedQualifications")
self.qualifications = qualifications
// Pass qualification to view
self.tableView.reloadData()
}
print-statements to the two methodscellForRowAtIndexPathandnumberOfSectionsInTableViewas well to see at what time they get called? It is perfectly normal for them to get called before your delegate methods comes up. But they should be called once again after you doself.tableView.reloadData(). Additionally you might want to show the contents of thenumberOfSectionsInTableViewfunction.