             
             if selectedArray .contains(indexPath){
                 selectedArray.remove(at: selectedArray.index(of: indexPath)!)
+                
             }
 
             

        
        // initial view set to grid
        sampleGallery.collectionViewLayout = gridFlowLayout
        
        //Handling tap gesture
        

        buttonToChangeView.isHidden = true
        deleteButton.isHidden = false
        
        gesture.allowableMovement = 4
        
        if gesture.state == .ended{
            return
