daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Feb 16th, 2019 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var alreadyTapped = false
  2. override func viewDidAppear(_ animated: Bool) {
  3.     alreadyTapped = false
  4. }
  5. override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  6.     if alreadyTapped { return }
  7.     alreadyTapped = true
  8.     performSegue(withIdentifier: Constants.Segue.DETAIL_VC, sender: collectionView.cellForItem(at: indexPath))
  9. }
  10.    
  11. override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  12.         DispatchQueue.main.async {
  13.             performSegue(withIdentifier: Constants.Segue.DETAIL_VC, sender: collectionView.cellForItem(at: indexPath))
  14.         }
  15.     }
  16.    
  17. var didSelectTime = Date()
  18.  
  19. func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  20.  
  21.     //MARK:- Prevent multiple calls. If elapsed time is less than 1 sec, do nothing
  22.     if Date().timeIntervalSince(self.didSelectTime) < 1.0 {
  23.         return
  24.     }
  25.     self.didSelectTime = Date()
  26.     .....
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top