Chapter    3

Collections

Collections are used in almost every application for data storage, retrieval, searching, and sorting. Recipes in this chapter will focus on the most common collection types, Array and Dictionary. Both arrays and dictionaries are generic collections in Swift; however, not all collections are arrays or dictionaries. Swift does provide lower level collection and sequence functions and protocols that perform individual features of the Array and Dictionary generic types.

This chapter focuses on the Array and Dictionary generic types. In Swift, arrays and dictionaries are strongly typed, unless otherwise specified. The recipes presented in this chapter are

  • Creating an Array
  • Counting the Number of Items in an Array
  • Managing ...

Get Swift Recipes: A Problem-Solution Approach 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.