Match App - Card flipping

Its me again!

I’m at the point where we test the cards to flip and of course, they don’t!

I think this may be down to issues with my IBOutlets but I’m not sure. They seem to break for no reason - as they did earlier in the building of this app. Both IBOutlets were not greyed through. So I re connected again. Not sure this is the correct way to fix IBOutlets. When deleted the circle in the code line just seems to do random buggy things appearing on different lines and being a pain to delete.

What would be really helpful would be a pdf of the complete code for the app to reference. Ideally at the end of each stage. Very difficult to check back for errors using just the video. Would have thought this would be in the resources?

also would be useful to have a flow diagram of each step, just to understand how we logically decide to do things. This would basically be a chronological s list of the comments put into the code. This would help with our own future development as coders when we dont have a video lesson guiding us through the thought processes of app creation

The empty circle for IBOutlets is a strange thing that Xcode does all the time. If you re-connect, you may have two references to the same IBOutlet which will create a crash when you run it.

Here is my code for the flip for the course:

func flip() {
        
        UIView.transition(from: backImageView, to: frontImageView, duration: 0.3, options: [.transitionFlipFromLeft, .showHideTransitionViews], completion: nil)
        
    }
    
    func flipBack() {
        
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.7) {
            UIView.transition(from: self.frontImageView, to: self.backImageView, duration: 0.3, options: [.transitionFlipFromRight, .showHideTransitionViews], completion: nil)
        }
        
    }

My Outlets show they are not connected, but they are is it runs fine. I generally ignore the circles! :slight_smile:
swift%202019-11-21%2017-48-11

Let me know if that does not work.
Blessings,
—Mark

You know that this is the perfect scenario to use the Connections Inspector?

So in my attached image you can see I have a button and I have ctrl + dragged to my viewcontroller code and created an action and outlet.

Now, although my circles are filled in grey, as mentioned sometimes they are not. So what you should do is select your object, in this case the button, and then look at your Connection Inspector (far right).

This shows you what is connected to your object. If there is nothing shown here then you can be assured that your outlets and/or actions are not connected.

2 Likes

Good call! I always forget about that panel!

Blessings,
—Mark

the card isn’t flipping!
Screen Shot 2020-04-02 at 6.00.24 PM|690x455