Skip to content

Instantly share code, notes, and snippets.

@ctrevarthen
Last active November 19, 2015 03:40
Show Gist options
  • Save ctrevarthen/4f3e15c0635847e3e158 to your computer and use it in GitHub Desktop.
Save ctrevarthen/4f3e15c0635847e3e158 to your computer and use it in GitHub Desktop.
ShopQuick - ShoppingListVC with SWTableViewCell Delegate methods - actions
enum LeftUtilityButtons: Int {
case Purchase
case Favorite
}
enum RightUtilityButtons: Int {
case Delete
}
// MARK: SWTableViewCell Delegate Methods
func swipeableTableViewCell(cell: SWTableViewCell!, didTriggerLeftUtilityButtonWithIndex index: Int) {
switch index {
case LeftUtilityButtons.Favorite.rawValue:
if let indexPath = self.shoppingListTableView.indexPathForCell(cell) as NSIndexPath! {
// TODO: Add Favorites functionality here
}
case LeftUtilityButtons.Purchase.rawValue:
if let indexPath = self.shoppingListTableView.indexPathForCell(cell) as NSIndexPath! {
// TODO: Add Purchased functionality here
}
default:
break
}
}
func swipeableTableViewCell(cell: SWTableViewCell!, didTriggerRightUtilityButtonWithIndex index: Int) {
switch index {
case RightUtilityButtons.Delete.rawValue:
if let indexPath = self.shoppingListTableView.indexPathForCell(cell) as NSIndexPath! {
// TODO: Move Delete functionality here
}
default:
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment