Join Todd Perkins for an in-depth discussion in this video Using methods, part of Programming for Non-Programmers with iOS 8.
- Now that we've talked a little…bit about what methods are, let's…gets some practice using methods.…In Main.storyboard I have a Label…on the screen and I've expanded its area.…And, I've actually connected that…in ViewController.swift to a variable.…If you're feeling lost at all right now,…watch the movies in the last chapter about…connecting variables to user interface elements.…So, what we're going to do here…is create a method that's going to update this Label.…
So, let's pretend that we're working on a game…and we want to create the scoring method.…So, I'm going to go a few lines…under this variable declaration and…I'm going to type the func key word.…Notice that it turns pink.…Then I'm going to type the name…of our method which is going to be didScore,…and then parentheses.…And I mentioned that we want to wrap…the method in curly braces.…Now, we can actually do it, like so,…with the curly braces starting…on a separate line, or we can start the…open curly brace on the same line…as the method declaration.…
It doesn't matter.…
If you find you'd like to learn more, see iOS App Development Essential Training, Foundations of Programming: Fundamentals, or any of the other programming courses in our library.
- Installing Xcode
- Creating an Xcode project
- Configuring the iOS Simulator
- Understanding variables
- Connecting visual objects to variables
- Understanding functions, methods, and selectors
- Connecting a button to a method
- Using conditional statements
- Setting up the user interface
- Connecting code elements to build an app
Skill Level Beginner
1. Setting Up Your Coding Environment
Creating an Xcode project3m 38s
2. Programming Building Blocks: Variables
3. Programming Building Blocks: Functions
4. Programming Building Blocks: Conditional Statements
Using conditional statements4m 11s
5. Building Your First Full Application
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.