How To Make an App – Ep 12 – Methods and Button Taps

How To Make iPhone Apps with NO Programming Experience!
Lesson 12: Methods and Button Taps
This lesson introduces methods with parameters and return values as well as handling button taps from the user!

Download the Key Takeaways Lesson Notes!

My Courses:

This video series uses the latest and greatest from Apple (Xcode 8, Swift 3, iOS 10) and will teach a beginner with no programming experience how to make iPhone apps. I’m creating these videos with the assumption that the student has no prior knowledge and is starting from scratch.

The lesson plan for the How To Make an App series can be found on my site here:

For more tutorials on how to build iPhone apps, make sure you subscribe and visit my site where you’ll find a community of like minded learners! Learning something new is always more fun with other people!


CodeWithChris is dedicated to teaching beginners and non-programmers all about building iOS apps. On the site, you’ll find a ton of free resources and tutorials to aid you on your journey to learn iOS development. Many people have successfully picked up Swift 3, Xcode 8 and app building from my course and materials!

Intro & Outro music
“Heartbreaker” by Jahzzar (






33 responses to “How To Make an App – Ep 12 – Methods and Button Taps”

  1. Rhett Wang Avatar

    Hi, Chris. Am new to xcode. Your video is awesome for me.

    I have a question here.

    in function increaseAge, it seems like even I don't put return value it still works. Like as below.

    func increaseAge(increaseBy: Int) {
    age += increaseBy

    I am confused why you put return age in your demo.


  2. Łukasz Starosielec Avatar

    Hi Chris. Just a quick question. I am running the project in Xcode 8.3.3 and it seems that a few thing have changed since beta. After creating IBAction by dragging the blue line from the button to ViewController there is an underscore before the "sender" argument. It all works fine after manually changing Any (not AnyObject as it is not default and not even showing in the menu) to UIButton BUT if I remove underscore the app crashes. However if I write the whole function manually without underscore it works fine. Xcode voodoo?

  3. Slopestyle 2022 Avatar

    These are awesome thank you.. Do you know why Im getting __lldb_expr_24.Person and not just Person?

  4. Shakes Peirre Avatar

    I am not able to get the "action" option in the drop-down menu at 12:31 in the video…

  5. carlos fernandez Avatar

    Excellent excellent, i get a little confused at first but after the second view i get it. Thanks you really know how to explain to slow brains like mine lol thanks Chris

  6. DjRichiAC Avatar

    I couldn't be happier with this whole series of how to make an app without experience.
    I had some experience in programming before but swift was a dark place for me until now. Thanks a lot for helping.
    There is one point that i didn' t quite get. Why do you need class functions. I mean the functions are "methods" to get and set information of the variables of an object but what does this kind of class methods make?.
    In this example you said that class method average age could be asked directly from the class person but the question is: if there are 3 objects person running around each with an age of 10 , 20 and 30 and then you call person.averageAge() will this method return 20 or so? i mean, it would be good to get an example on when to use this kind of class functions. Thanks a lot chris.

  7. iCH4N6 Avatar

    how did u have syntax error icon shown next to the number of the line of code? Mine just show a syntax error on the top left corner??

  8. Esm10 Avatar

    Hey Chris! When im at the simulator, the button won't react to the tap.
    Can you help? Awesome tutorial though!

  9. Torsten Schmidt Avatar

    Chris, I have followed your great tutorials so far, but has now run into a problem.
    When i try to run the program I get a build error and the following message:
    ld: entry point (_main) undefined. for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
    I am using Sierra 10.12.5 and xCode 8.3.3 – have you any ideas to what the reason might be for the linker error?

  10. GrandZodiac Avatar

    Thank you so much! you're an awesome teacher and your videos are super easy to follow and learn from

  11. # DEATH MAN # Avatar

    How do you get the double screens?

  12. Ernesto García Avatar

    Thank you, Chris!! You're an excellent teacher and your lessons are clear, easy to understood and well structured to progress in order to get a basic knowledge of what we´re facing (first approach to app development and whether or not commit our selves to take a further step to do so). In my case, I am looking forward to it. Please, remain being so kind and generous as to devote your time and efforts to give people selfless opportunity to learn coding. If not yet, I hope you be rewarded appropriately in foreseeable future.

  13. Zoltán Arnóczky Avatar

    Excellent tuts, thank you!

  14. MR. Amicus Avatar

    Hi Chris, I am Jannes.I am 15 years old.And I come from Belguim.I have a question for you.I wanna make a game that you can play with friends.So I need some sort of Lobby that gives a code.And if your friend and you type de code in.Your in the same Lobby.So you can play against each other.But I don't know how to code that.Can you help me.Thanks

  15. khurram saeed Avatar

    Chris- This is really great, how you are diligently working on these tutorials and never give up. So am I on this 12th episode. Really want this. And this has been so helpful. Keep up the good work brother.

  16. abzalbek issabekov Avatar

    it is not working , giving me that : class AppDelegate: UIResponder, UIApplicationDelegate { Thread1: signal SIGARBT

  17. Harry Williams Avatar

    Hello, I got an error with the button line of code,
    @IBAction func dealTapped(sender: UIBbutton). {

    Also, when I right click the button and drag the touch up inside to view controller the only thing I can drag it to is first responder. Thanks for the helpful videos!

  18. Kamila Gales Avatar


    so when I opened up the xcode project to connect a function to the button, under the asistant editor view (where u click and drag and write the code) I messed something up while typing and deleted the whole writing, now its GONE! I have tried closing and opening 100 times but its blank now, tried typing it in manually but a million of errors show up HEELLPPPP!!!! =(

  19. NRX Avatar

    using the word "function" interchangeably with "method" was throwing me off. Thank you for clarifying.

  20. Ric S Avatar

    Hey Chris, I'm still a little confused on the concept of functions with return values. Around 5:20, I don't really understand how the function updatedAgeAndName take in values whereas the next function returns values, because it seems like they both in the end change the final value of the age. Btw I've started watching a few videos from your new swift series and I wanted to see if you had any suggestions on if I should watch that series first then finish this one, or whichever. Thanks!

  21. The Pretty Unicorn Avatar

    Question: How do you know where to drag place each image in the coding space thing? Why do you place the cards and score at the top and the button at the bottom, does it make a difference?

  22. Forrest T Avatar

    I could use a hint. When I run the program I get an error: Misplaced View Frame for Stack View will be different at runtime.

    When I grabbed the buttons to link them to the functions they moved, but I moved them back. Looks like things are pretty sensitive, Any debug ideas?
    Thanks in advance.

  23. jmoral214 Avatar

    how do you get those numbers in the left column to help you know what line a code is on??? i dont have it on and i cant figure out how to turn it on

  24. Max Schellenberg Avatar

    Thanks for the lessons I look forward to continuing this series!

  25. Colin Ector Avatar

    Hi Chris. Firstly thank you for these great tutorials. Can you tell me why when you press deal all the comments (green text) dissapears from the code on the right. Also i don't seem to be able to go in and type anything there now. It happens at 16.58. Thanks again

  26. Stephen Deban Avatar

    Great lessons, Chris. The best I've found online for Swift.

  27. Andy17704 Avatar

    When I test my app the only thing I can see is the background image. Not any of the card backs or buttons

  28. Puma Mc Avatar

    I like your videos! They're really helpful!

  29. Mogen Cheng Avatar

    bro your lessons are insanely good. Love how you explain different ways of doing things. The quality and clarity of your videos are gold. (but i watch them at 1.25x cause it's just a tad slow LOL)

  30. August Halverson Avatar

    I received an error message when i clicked the button.
    Thread 1:signal SIGABRT

  31. Rean Code Avatar

    how do you set properties as private properties?

  32. トカゲの財団 Avatar

    Method IS function? My whole life was a lie..

  33. Jesse Willingham Avatar

    I like it how the views drop as people have given up as the videos go along, It's like what you said Vid 1, these are for people who really want to do this. thanks for the help though, brings clarity to the madness.

Leave a Reply

Your email address will not be published. Required fields are marked *