5

Collection Types

You’ve learned quite a lot at this point! You can now create a program that stores data in constants or variables and performs operations on them, and you can control the flow using conditionals and loops. But so far, you’ve mostly been storing single values.

In this chapter, you will learn ways to store collections of values. Swift has three collection types: arrays, which store an ordered list of values; dictionaries, which store an unordered list of key-value pairs; and sets, which store an unordered list of values.

By the end of this chapter, you’ll have learned how to create arrays, dictionaries, and sets, and how to perform operations on them.

The following topics will be covered in this chapter:

  • Understanding arrays ...

Get iOS 16 Programming for Beginners - Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.