Skip to content

Instantly share code, notes, and snippets.

@odrobnik
Created August 14, 2015 11:02
Show Gist options
  • Save odrobnik/df580d010e808c483ce7 to your computer and use it in GitHub Desktop.
Save odrobnik/df580d010e808c483ce7 to your computer and use it in GitHub Desktop.
Fetched Results in Swift
override func numberOfSectionsInTableView(tableView: UITableView) -> Int
{
if let sections = fetchedResultsController.sections
{
return sections.count
}
return 0
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
if let sections = fetchedResultsController.sections
{
if let section = sections[section] as? NSFetchedResultsSectionInfo
{
return section.numberOfObjects
}
}
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment