Tag: functions
-
Understand and Use Closures in Swift
Have you ever seen some factory method in UIKit and see this strange parameter called completion or completionHandler? Usually you put nil there and leave it alone. These strange things like (Double,Double) -> Bool things are closures. Closures are functions you use as types, often in parameters of other functions. In this lesson we’ll explore…
-
Kinderswift 8: Making Your Own Functions
Transcript In our last lesson we learned about functions. Swift, and most modern programming languages are nothing more than writing groups of your own functions. In this lesson, we will write our own functions. In our last lesson you may remember this function Which made varying colors of gray. Let’s start by making our own…
-
KinderSwift 7: Introduction to Functions
This session we will learn about functions by making colors with UIColor. Transcript Welcome to lesson 7 of KinderSwift. In our last lesson we used this to convert a Int into a Double and this to convert a Double into a Int. Both of these are functions. Functions take the data within the parentheses and…
-
from Apple to Raspberry Pi: Making Classes in Python
Objective-C and Python are similar when it comes to defining new classes, but be careful with their differences. In Objective-C we would define a class with two files: a header and an implementation file. In the header we would declare properties like this And possibly public methods In the implementation file we would have the…
-
From Apple to Raspberry Pi: Transitioning into Functions.
When I started Making App Pie, one of my big frustrations was wrapping my head around defining methods. I was used to C++ and Java functions. Objective-C and its Smalltalk roots just threw me. Now going into Python is difficult too — but for another reason. Once again dynamic typing in Python rears up to…