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 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.