I have done this million times in Objective-C but for some reason Swift is not working as expected. The following code does not populate the UITableView cell with one row:
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!
{
var cell = tableView.dequeueReusableCellWithIdentifier("BudgetTableViewCell", forIndexPath: indexPath) as BudgetTableViewCell
cell.budgetTitle.text = "My Budget"
return cell
}
override func numberOfSectionsInTableView(tableView: UITableView?) -> Int {
return 1;
}
override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
return 1;
}
I have made sure that the budgetLabel is hooked up properly in Storyboard. All the above methods are invoked but when the UITableView loads there is nothing displayed.
THE UITableViewController Template Apple Provides:
// #pragma mark - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView?) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 0
}
override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 0
}
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell? {
let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath)
// Configure the cell...
return cell
}