O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Enumerations and Pattern Matching

In Chapter 1, Getting Started with Functional Programming in Swift, we were introduced to enumerations briefly. In the previous chapter we got familiar with types and we learned that enums are sum types.

In this chapter, we will cover enumerations and algebraic data types in detail. Also, we will explore patterns and pattern matching in Swift.

This chapter will cover the following topics with coding examples:

  • Defining enumerations
  • Associated values
  • Raw values
  • Nesting and containing enumerations
  • Using enumerations
  • Algebraic data types
  • Patterns and pattern matching

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required