0

I have a UICollectionView, and I want to be able to delete a contained Cell (And content of the cell from Firebase) on long press gesture.

When a long gesture is recognized, I want a little "X" to appear on the cell that will let me delete it by clicking the "X" and then "Confirm" (Or Cancel).

My Cell Class:

    class ProductsCollectionViewCell: UICollectionViewCell
    {    
        @IBOutlet weak var ProductImageView: UIImageView!
        @IBOutlet weak var ProductName: UILabel!
        @IBOutlet weak var ProductPrice: UILabel!

        var productUniqueID: String!
    }

Do I need to add it here, or in my CollectionView? I already have this in my collectionView:

func collectionView(_ collectionView: UICollectionView, didSelectItemAt 
                    indexPath: IndexPath)
{
    // Display selected Item
    prodToLoad = products[indexPath.row]
    //prepare(for: "view_product_information", sender: self)
    performSegue(withIdentifier: "view_product_information", sender:self  )
}

So I basically need the same method just for a long gesture.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
MathEnthusiast
  • 101
  • 1
  • 10

0 Answers0