Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var alreadyTapped = false
- override func viewDidAppear(_ animated: Bool) {
- alreadyTapped = false
- }
- override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
- if alreadyTapped { return }
- alreadyTapped = true
- performSegue(withIdentifier: Constants.Segue.DETAIL_VC, sender: collectionView.cellForItem(at: indexPath))
- }
- override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
- DispatchQueue.main.async {
- performSegue(withIdentifier: Constants.Segue.DETAIL_VC, sender: collectionView.cellForItem(at: indexPath))
- }
- }
- var didSelectTime = Date()
- func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
- //MARK:- Prevent multiple calls. If elapsed time is less than 1 sec, do nothing
- if Date().timeIntervalSince(self.didSelectTime) < 1.0 {
- return
- }
- self.didSelectTime = Date()
- .....
- }
Add Comment
Please, Sign In to add comment