In this video tutorial, you'll learn how to delete cells from the collection view.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2005-video-tutorial-collection-views-part-5-deleting-cells
In this video tutorial, you'll learn how to delete cells from the collection view.
slight change needed in the finalLayoutAttributesForDisappearingItemAtIndexPath in the challenge.
Item 3 should be: if indexPaths.contains(itemIndexPath)
@daver235, This is the newer swift syntax that wasn’t available when the tutorial was produced.
I also used a guard statement to avoid nesting like so:
guard let dis = disAppearingIndexPaths where dis.contains(itemIndexPath) else { return attrs}
//…customisation
attrs?.size = CGSizeZero
attrs?.alpha = 1
attrs?.center = collectionView?.center ?? CGPointZero
return attrs