7. Types

When it comes to types, Swift offers three distinct families. Its type system includes classes, which provide reference types, and enumerations and structures, which are both algebraic value types. Each provides unique strengths and features to support your development. This chapter surveys some of the key concepts used in the Swift language and explores how its types work in your applications.

Language Concepts

Before diving into type specifics, this section offers a quick review of some key concepts that Swift uses in its language design. The following terms support your understanding of Swift’s type system and enable you to better understand what each type brings to your programs.

Reference and Value Types

When selecting types, ...

Get The Swift™ Developer’s Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.