
Disclaimer
The Swift language is still under development and the features explored in these videos might or might not change in the next releases of this language. It is your responsibility to check out the documentation for relevant information and feature changes.
Explore external parameter names in Swift, using first and second labels to clarify function calls, and learn how to enforce external usage and use hash syntax.
Learn how variable parameters create a local copy of passed values using the var keyword in swift, enabling you to modify parameters inside a function while keeping the original intact.
Explore how Swift functions use default parameter values, override them with explicit labels, and apply wildcard patterns to suppress parameter labels for cleaner calls.
Explore in-out parameters in Swift by passing a reference to a variable, enabling a function to modify external values and persist changes after execution.
Learn to return multiple values from a Swift function using a tuple return type for two integers, access elements with dot notation, and include an array as a third element.
Learn how functions in Swift can return other functions and be passed to functions, leveraging first-class objects to create inner functions and return them for later calls.
Learn how to return a closure from a function in Swift by returning an anonymous closure, declaring inputs and outputs, and using shorthand parameters.
Map method transforms each array value into a new value using a closure. Observe shorthand argument $0 and implicit return to create a mapped array.
Learn how the Swift filter method uses a closure to traverse an array and return a new array of elements that meet a condition, such as numbers divisible by two.
Filter a users array to remove those aged 21 using a closure to access age and compare with 21. Apply the $0 shorthand and Int cast to produce result array.
Learn how to sort arrays in place with Swift’s sort method, using closures to compare values, with ascending or descending order and optional verbose alternatives.
Combine map, filter, and reduce to produce an array of expired accounts by mapping each user to their accounts, filtering for hasExpired, and flattening the results.
Explore generics in Swift by building a generic add function that works with a placeholder type, and extend string, integer, and double to adopt a plus operator.
Learn to create a cocoa framework named my utility, add a swift file with a class utility and a class method hello world, and build and import it into project.
Learn to implement a generic class method in Swift that returns the first element of an array, safely handling empty arrays with if let.
Implement a generic indexOf utility for arrays in Swift that returns the index of a matching element as an optional Int, enumerates the array, and requires Equatable conformance.
Implement a generic contains method in Swift that uses filter with a closure to check an array of Equatable elements for a value, handles empty arrays, and returns a boolean.
Package code into a Cocoa framework and import it into another project. Create, build, and test my utility module to access its class methods.
Note: this course was published many years ago. Please consult with the documentations for the latest details.
This course focuses on the functional features of the Swift programming language. Concepts like closures, value capturing, higher order functions and closure inline expressions, among many more are covered through simple examples.
This course is relatively short but focused to give you a better understanding of functions and closures in Swift since they are as important as objects and classes.