Higher-Order Functions in Swift
Learn what higher-order functions are, and how to write and use them in Swift. Expand your understanding with examples from the Swift Standard Library, the new Swift Algorithms framework, and SwiftUI. By Catie Catterwaul.
Who is this for?
This course will be most helpful to developers who have some Swift experience, but aren’t familiar with functional programming concepts, and may struggle to make the most of functions and closures in their everyday Swift code.
Covered concepts
- Functions
- Functional Programming
- Swift Type System
- Swift Algorithms
- Sequence
- ViewBuilder
- Currying
Part 1: Higher-Order Functions in Swift
Learn how higher-order functions can help you level up your Swift skills, and review the function’s place in the Swift type system.
Write your first higher-order function, using a function as a parameter. Learn three ways to pass functions in as arguments.
Learn how map, one of the most useful higher-order functions, works behind the scenes, and try out some of its more custom cousins.
There are a plethora of higher-order functions waiting for you in the Swift Standard Library and the new Swift Algorithms framework! Check out a few of them, here.
Build two custom dynamic sequences from scratch with your new higher-order function skills.
Find out what higher-order functions are doing behind the scenes in SwiftUI by building a custom View with a @ViewBuilder.
A less common type of higher-order function is one that returns a function. Learn how to break functions down with currying.
Make currying easier by writing a reusable generic currying function.
Learn how to use function composition to merge smaller functions together.