Skip to content

Instantly share code, notes, and snippets.

@madhu314
Created February 8, 2017 07:32
Show Gist options
  • Save madhu314/4ee6c8527c9c81678bb687a93b3230b6 to your computer and use it in GitHub Desktop.
Save madhu314/4ee6c8527c9c81678bb687a93b3230b6 to your computer and use it in GitHub Desktop.
func remove(item: ListItem, on collectionView: UICollectionView) {
let foundIndex = items.index { (given) -> Bool in
return given.id == item.id
}
if let index = foundIndex {
items.remove(at: index)
collectionView.deleteItems(at: [IndexPath(item: index, section: 0)])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment