Last active
July 19, 2017 19:07
-
-
Save jeantimex/c470bcf9c1b738c0286b652988326fb5 to your computer and use it in GitHub Desktop.
toggleSection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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