7.8 Summary
In this chapter, you learned about enumerations and their benefits for programmers. In a nutshell, enumerations are groups of fixed constant values. Instead of repeating literal values all over the codebase, it makes more sense to group them as enumerations because it makes code maintenance much easier.
Enumerations caxome in three flavors: case values, raw values, and associated values. Naturally, it is possible to iterate through cases—but beyond that, associated values also support recursion and generic types. Enumerations also offer advanced features like computed properties and functions, and you can conduct operations over enumeration cases.
Starting from this chapter, we will walk you through a series of Swift types that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access