Skip to content

Instantly share code, notes, and snippets.

@jeantimex
Last active July 19, 2017 19:07
Show Gist options
  • Save jeantimex/c470bcf9c1b738c0286b652988326fb5 to your computer and use it in GitHub Desktop.
Save jeantimex/c470bcf9c1b738c0286b652988326fb5 to your computer and use it in GitHub Desktop.
toggleSection
extension CollapsibleTableViewController: CollapsibleTableViewHeaderDelegate {
func toggleSection(_ header: CollapsibleTableViewHeader, section: Int) {
let collapsed = !sections[section].collapsed
// Toggle collapse
sections[section].collapsed = collapsed
header.setCollapsed(collapsed)
// Reload the whole section
tableView.reloadSections(NSIndexSet(index: section) as IndexSet, with: .automatic)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment