
Stanford CS193p: iOS Development with SwiftUI | 2025 | L3: Model and UI & Swift Type System
All course materials are available at https://cs193p.stanford.edu.
The 3rd lecture of the 2025 version of Stanford's CS193p course (developing applications for iOS using SwiftUI). This lecture focuses on Swift's type system fundamentals and explains the Model-UI separation principle in SwiftUI, emphasizing that the Model contains the app's core logic and data (UI-independent) while the UI is a declarative, reactive visual manifestation of the Model. Covers the Swift type system, including: structs vs classes (value types vs reference types). Shows how enums can have associated data; generics for type-agnostic programming (like Array); how Optionals work; failable initializers that return Optionals; and extensions for adding functionality to existing types. Emphasizes Swift's strong typing, immutability by default, and the importance of clearly marking sources of truth with @State. All concepts are presented as building blocks for the CodeBreaker app development in the next lecture.
Paul Hegarty is a Lecturer who has been teaching CS193p at Stanford since 2010.
The 3rd lecture of the 2025 version of Stanford's CS193p course (developing applications for iOS using SwiftUI). This lecture focuses on Swift's type system fundamentals and explains the Model-UI separation principle in SwiftUI, emphasizing that the Model contains the app's core logic and data (UI-independent) while the UI is a declarative, reactive visual manifestation of the Model. Covers the Swift type system, including: structs vs classes (value types vs reference types). Shows how enums can have associated data; generics for type-agnostic programming (like Array); how Optionals work; failable initializers that return Optionals; and extensions for adding functionality to existing types. Emphasizes Swift's strong typing, immutability by default, and the importance of clearly marking sources of truth with @State. All concepts are presented as building blocks for the CodeBreaker app development in the next lecture.
Paul Hegarty is a Lecturer who has been teaching CS193p at Stanford since 2010.
Stanford Online
You can gain access to a world of education through Stanford Online, the Stanford School of Engineering’s portal for academic and professional education offered by schools and units throughout Stanford University. https://online.stanford.edu/
Our robust ...