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.

Leave a rating/review
Download materials
Save for later
Comments
Share

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

01
Toggle description

Learn how higher-order functions can help you level up your Swift skills, and review the function’s place in the Swift type system.

Toggle description

Write your first higher-order function, using a function as a parameter. Learn three ways to pass functions in as arguments.

Toggle description

Learn how map, one of the most useful higher-order functions, works behind the scenes, and try out some of its more custom cousins.

Toggle description

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.

Toggle description

Build two custom dynamic sequences from scratch with your new higher-order function skills.

Toggle description

Find out what higher-order functions are doing behind the scenes in SwiftUI by building a custom View with a @ViewBuilder.

Toggle description

A less common type of higher-order function is one that returns a function. Learn how to break functions down with currying.

Toggle description

Make currying easier by writing a reusable generic currying function.

Toggle description

Learn how to use function composition to merge smaller functions together.