Every app needs a way to model its data and organize its behavior. This module introduces the building blocks Swift gives you for that: structs and classes to represent things like users, products, or settings, and protocols to describe behavior that different types can share.
You'll learn how to define properties, methods, and initializers, and the most important difference between the two: structs are value types and classes are reference types. A short video compares them side by side, so you can tell when to reach for each one. You'll then see how protocols let unrelated types promise the same capabilities.
These ideas show up constantly in SwiftUI, where views and data models are built from exactly these pieces. Some lessons are clips cut from longer courses. When you're ready, continue on to SwiftUI Fundamentals.
Define structs with properties, methods, and initializers, and see how they behave as value types.
Create classes, work with inheritance, and understand how they differ from structs.
A short side-by-side comparison of value types and reference types, and when to use each.
Define protocols and have types conform to them to share behavior.
A second walkthrough of protocols and conformance.