26 thoughts on “11. Hooking it all up – Swift IBOutlet properties”

  1. Wow, this video really made things start to make sense! It all of a sudden brought together the connections between MVC in lesson 4, the classes with their properties in lesson 9, the UIKit classes in lesson 10, and the objects in the storyboard. Really good. However, since I haven’t actually seen the UIKit classes that we are working with/overriding, it’s all still a little like there’s this black box somewhere behind the curtain. Are those in our project somewhere? How can you know how to work with all these UIKit classes?

    • Hey Tony, awesome! The list of UIKit classes is here:
      https://developer.apple.com/reference/uikit

      There are a lot but probably a small bunch that are most commonly used. Over time when you need to accomplish something, you’ll check the catalog first to see if Apple gives you anything standard to use and if it somewhat fits the bill, you can use that class as it or create a subclass of it and extend it’s functionality!

  2. Awesome!!!! Your voice never even breaks in the video. I don’t even think I heard you cough yet. Your are awesome.

    • Hey Michael, in the center of your storyboard near the bottom where it says wAny hAny, click that and change it to the size class that I have and you should see your elements. (You can try out the various size classes until you get the right one)

      • Ah yes, I went on to purchase the rest of your course and am enjoying it. I am now in the lesson where I am learning about different size classing. I figured it out. Thanks for the response.

        However I have tried to go back to my card match game and want to make a portrait view where all the cards are all displayed on one screen apposed to scrolling. I created a new UIView where I hope to position on the cards when its in portrait mode, however its giving me this error when I try to connect the PortaitContentView to the view controller.

        http://gyazo.com/31baf7cdf5de18ff7c5d6576401fa9b3

        I have learned a lot so far, but have SO far to go.
        Thanks for your help.

          • Hey Chris,

            Thanks for responding, I can’t remember what the problem was but yes I did end up getting my issue fixed. As I go through your course I continue to go back to the card matching app to customize it further practicing things I learned in your other lessons. I have encountered a bug that maddens me when I play the game. Due to the fact that we are creating a random number, we essentially can draw in multiple of the same image, however obviously when you try to match them it will tell you it is incorrect. I have set out to fix this problem and have found it more difficult than I thought.

            I came to the conclusion that I needed to create and Array, shuffle that array, and then in the game model systematically loop in the first 8 items in that shuffled array to give you the random cards placed on the board, however there will never be any duplicates. I could not figure this out on my own and went to the internet to find the “Fisher Yates Shuffle”

            Anyways, I am coming up with an error, and I think it must have something to do with how I’m storing the shuffled array and then using it. But I could be completely off base all together. I am wondering if you could look this over and give me some direction, I would be very grateful.

            http://gyazo.com/0a8e38def207d3717b43be4f7061b26e

            Thanks and hope your having a great day.

          • Hey Michael, because “shuffledNumbers” is an array, it’ll only accept 1 index in the bracket so that’s what is giving you the error.

            I’m not sure there’s a function to grab the first 8 items of an array as a separate array so what I’d do is create a for loop that loops 8 times and in each iteration, grab the first item of “shuffledNumbers”, append it to “cardToBePlaced” and then remove the first item from “shuffledNumbers”

          • I fixed it, and sent you in another issue where I was trying to shuffle the array so that there would be no matching images with different values, I was finally successful at doing this. Feels really good.

          • Hey Michael, awesome job! I’m going through my email now so I should get to your other inquiry. If i don’t respond by today that means for some reason it didn’t reach my inbox. In that case, please ping me again!

  3. Hey Chris, thank you for your great work and for sharing it! The First Time I connected iboutlet everything went well, I finished the video and closed Xcode. Next day I wanted to continue with the next video ran the scheme and an error came up: aDecoder = (NSCODER)balbla and self = (war.viewcontroller)balbla .
    Can you explain what went wrong?

    Thanks
    Julian

  4. Around 5:13 in reference to the below:

    class ViewController : UIViewController

    . . . you said that UIViewController was a subclass of ViewController.

    However, I thought that it was the opposite. Isn’t the format (syntax) rather:

    class SomeSubclass: SomeSuperclass ?

    Thanks in advance for any clarification!

  5. Great Videos Chris,keep up the good work. question regarding tutorial 9- why did we not declare an IBoputlet property for the CardContainerView?

  6. Firstly thanks for these. Really helpful to go through. One thing I can’t seem to do is drag the controls from the storyboard to the viewcontroller. I hold down control and drag, you see the blue line following your mouse but it doesn’t then create a horizontal blue line in the viewcontroller (as it does in yours) and therefore on release nothing is created. Any ideas on where I’m going wrong?

    • Ok, think I sussed it. I had renamed my viewcontroller which I guess was breaking the link between storyboard and viewcontroller. What’s the best way to rename? I was just renaming the file and then changing the class name.

      • Hey Gilbert, you can do what you did but after you rename the file and classname, in the storyboard, highlight the view controller and then in the right hand side attribute inspector, under one of the tabs, you can set a custom class. Click into the dropdown and choose your renamed class!

  7. Is there any way to find these lost connections in the debugger? Cuz I actually made that mistake of deleting it and having the undirected link still stablished, but my debugger wasn’t really giving me any hints that was the problem until you brought it up in the course.

Leave a Comment