This course is available as part of the raywenderlich.com Professional subscription. To learn more click here
Pro

Higher-Order Functions in Swift

Aug 31 2021 · Video Course (34 mins) · Intermediate

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.

4.6/5 5 Ratings

Version

  • Swift 5.3, iOS 14, Xcode 12.5

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.

1

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

2

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

3

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.

4

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

5

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

6

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

7

Make currying easier by writing a reusable generic currying function.

8

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

9

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

Contributors

Comments