Listen

Description

Swift

Follow-up/Corrections
2 episodes ago, Darryl mistakenly referred to Swift 1.3 beta. He meant to say 1.2 beta.

Tuples

Contents can be decomposed in a manner very similar to the decomposition of an enum value’s associated values
Elements can be accessed using dot notation with its zero-based index.

Particularly useful as the return value of functions

Group values into a single compound value.
Values need not be of the same type
Multiple ways of getting at the composed values

“_” can be used to ignore parts of a tuple.

Elements of a tuple can be named, and subsequently accessed by name using dot syntax.
If the data structure is likely to persist beyond a temporary scope, consider a class or structure instead.

Functions

syntax
parameters

local vs. external parameter names
variadic
in-out
default parameter values

 return

multiple return values
option tuple return types
void defined as empty tuple ()

function types

syntax
as parameters
as return types

Closures

terseness
Types

Global Functions
Nested Functions
Closure Expressions

Trailing Closures