ios – VC.isHidden = true not working as anticipated


I’ve a Viewcontroller ThirdViewControllerPassenger which has a number of subviews on it, together with a UICollectionView known as collectionViewwith horizontally scrolling Playing cards. Thus far, so good. I’ve written code to be executed from a faucet motion from contained in the uicollectionviewcells. Tapping the motion does work and prints to console. Nonetheless, by urgent one among these playing cards I need to disguise the entire UICollectionView. I’ve arrange an onTap Operate as proven right here:

@objc func onTap(_ gesture: UIGestureRecognizer) {
    if (gesture.state == .ended) {
        /* motion */
        if favCoordinate.latitude == 1.0 && favCoordinate.longitude == 1.0 {
            //There was an error OR the Person has pressed the brand new Deal with button
            ThirdViewControllerPassenger().collectionView.isHidden = true
            if ThirdViewControllerPassenger().collectionView.isHidden == true {

As you may see, I’ve already been troubleshooting a bit. I’ve examined ThirdViewControllerPassenger().collectionView.isHidden = true from ThirdViewControllerPassenger straight, which labored. It doesn’t work, nevertheless, from a cell. The “finished!” print by no means will get printed to console, so the decision by no means arrives. I’m wondering why or what I’m doing improper.
Do not thoughts the primary if assertion, that perform is just not written but. That ought to not matter. I’m guessing that the remainder of my code wouldn’t result in any extra clues.


Please enter your comment!
Please enter your name here