9 Classes
In Swift, classes are reference types used to define blueprints for objects and methods. Classes are arguably the core entry point for object-oriented Swift, as they support inheritance, initialization, and deinitialization. Classes are ideal for modeling complex and shared elements.
In this chapter, you will learn about classes—the conceptual pillars of object-oriented programming. In Swift, classes are very similar to structs, but they have significant differences. While their functionalities overlap, they can’t fully replace each other as both offer different mechanisms. As an introduction to classes, let’s compare them to structs to understand where each stands in the Swift ecosystem. Table 9.1 acts as an entry point, highlighting ...
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