Animations for a specific button in an outlet collection

Hi All,


I am new to Xcode programming and I am trying to make a game that has an array of cards (about 20-40) that flip over when you tap on them. (This is like the Concentration game where you try to make matches based on your memory.) However, I tried to implement the transition animation method of flipping the card over to reveal the picture on the other side, but I am unsure of how to do so. Here is the method that I want to use for the animation:


UIView.transition(

with: chosenButton, duration: 0.6, options: [.transitionFlipFromLeft], animations: {

chosenButton.isFaceUp = !chosenButton.isFaceUp

}

)


However, this method seems to only work if I am only tapping one button, but doesn't work when that button is connected to an outlet collection. I connected about 20 cards to the same action (touchCard) and when I implement the above code the chosenButton does the flip animation even if I press on a different button in the outlet collection!


My question is: how do I make the button do the flip animation only if it is being pressed, and not when any of the other buttons connected to the same action and outlet collection is being pressed.


Thanks,

Andrew Collins