Skip to content

Instantly share code, notes, and snippets.

@daniloc
Created May 14, 2019 19:49
Show Gist options
  • Save daniloc/06fc4bbf36510f0045a3fd7f9bc08684 to your computer and use it in GitHub Desktop.
Save daniloc/06fc4bbf36510f0045a3fd7f9bc08684 to your computer and use it in GitHub Desktop.
@IBAction func handlePuppySwitch(_ sender: UISwitch) {
let updateIndexPaths = [IndexPath(row: 0, section: TableSections.dynamicSection.rawValue)]
if (sender.isOn) {
puppyLabel.text = "Puppy Enabled"
dynamicContent.insert("Puppy is on!", at: 0)
tableView.insertRows(at: updateIndexPaths, with: .bottom)
} else {
puppyLabel.text = "Puppy"
dynamicContent.remove(at: 0)
tableView.deleteRows(at: updateIndexPaths, with: .left)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment