Detect Matches and Omit Swiped Cards
Tinder Firestore Swipe and Match
In this lesson, we'll determine if there are matches between users that have swiped cards to the right. This can be done easily by diving into the swipes collections to see which documents contain the like information for the currently logged in user. In addition to this, we'll move onto omitted the cards that we've swiped before from being presented in the main screen.

Comments (5)
st4n
4 years ago
Hi man, great pace - new episodes, livestreams. Go get a beer maybe :) or three... in checkIfMatchExists we should check if our swipe is "right". Now, no matter in which direction we swipe - there will be a match.
st4n
4 years ago
or rather in saveSwipeToFirestore if didLike == 1 { self.checkIfMatchExists(cardUID: cardUID) }
flashtrend
4 years ago
When swiping, if I switch directions it freezes up for a second For example if I go right, right, right its very smooth but if I go right, left, right, left there is a pause at every direction change Has anyone else experienced this, or know how to fix it?
Brian Voong
4 years ago
flashtrend
4 years ago
Awesome! I don't think I would've caught that that was the issue. Working great now.
Lucrecio909
4 years ago
My Data does not print. Any idea on how to fix? Thank you. " fileprivate func checkIfMatchExists(cardUID: String) { // How to detect our match between two users? print("Detecting match") Firestore.firestore().collection("swipes").document(cardUID).getDocument { (snapshot, err) in if let err = err { print("Failed to fetch document for card user:", err) return } guard let data = snapshot?.data() else { return } print(data) } }"
Lucrecio909
4 years ago
Got it to work. I logged in with a different user and its working fine now.
Cinquain
4 years ago
Good stuff
Eugeneberezin
4 years ago
For some reason, the logic of omitting users stops working after I delete all of my swipes. It does not work for new swipes. I basically can reload swiped users again.
HELP & SUPPORT