Skip to content
KnowledgeCity

Swift: Functions and Closures

Learn about functions and closures in Swift
Preview the first lesson free — get full access to all 7 lessons.
Course: On-Demand
Advanced Provider Mark Nair  7 Lessons ·  34m  in English 

Course Description

The topics discussed in this course will build on your understanding of the Swift programming language by discussing and explaining functions and closures. To create usable apps, it is essential that you have a firm understanding of functions and closures, as well as how to implement them. One of the more difficult concepts of Swift to understand is closure, which is why this course will go through basic closures, spend time on how to accept a parameter in a closure, and then see how to return a value from a closure.

In Swift: Functions and Closures, you will learn about functions in Swift, including closures and how to utilize them in your code. We’ll look at overloading functions, which are functions that have the same name as another function, but with a different set of parameters. We’ll also work on variadic functions and look at how to use a function as a parameter in another function.

What You'll Learn

  • Understand overloading functions — functions sharing a name but with a different set of parameters
  • Recognize and work with variadic functions in Swift
  • Use a function as a parameter inside another function
  • Write basic closures and accept parameters within a closure
  • Return values from a closure
  • Use closures as function parameters

Key Takeaways

  • This course builds on your understanding of the Swift programming language by explaining functions and closures.
  • A firm understanding of functions and closures, and how to implement them, is essential to creating usable apps.
  • Closures are one of the more difficult Swift concepts, so the course covers basic closures, accepting a parameter in a closure, and returning a value from a closure.
  • Overloading functions are functions that have the same name as another function but with a different set of parameters.
  • The course also covers variadic functions and using a function as a parameter in another function.

Frequently Asked Questions

What does this course cover?

It covers functions and closures in Swift, including overloading functions, variadic functions, using functions as parameters, basic closures, accepting parameters in a closure, and returning values from a closure.

Who is this course for?

It is for learners building on their understanding of the Swift programming language who want a firm grasp of functions and closures and how to implement them to create usable apps.

What are overloading functions?

Overloading functions are functions that have the same name as another function but with a different set of parameters.

Why does the course spend time on closures?

Closures are described as one of the more difficult concepts of Swift to understand, so the course works through basic closures, how to accept a parameter in a closure, and how to return a value from a closure.

What skills will I gain from this course?

Skills include function overloading, functional programming, generic functions, stored functions, Swift programming, and user-defined functions.