Stanford CS193p: iOS Development with SwiftUI | 2025 | L4: CodeBreaker's Model
Автор: Stanford Online
Загружено: 2025-11-25
Просмотров: 4762
View course details: https://online.stanford.edu/courses/c...
All course materials are available at https://cs193p.stanford.edu.
The 4th lecture of the 2025 version of Stanford's CS193p course (developing applications for iOS using SwiftUI). This lecture focuses on implementing the Model-UI separation in CodeBreaker. CodeBreaker's Model is created, including CodeBreaker (main game logic), Code (with enum Kind for master/guess/attempt code types), and Peg (implemented simply as a type alias for Color). Then a CodeBreakerView is created that becomes a visual manifestation of the Model. Key concepts include: proper file organization, using @State for mutable UI state, marking functions as mutating in structs which can be mutable, if-let Optional unwrapping, nil-coalescing operators, and multi-touch input with onTapGesture(). Demonstrates how SwiftUI automatically updates the UI when the Model changes, implementing tap-to-cycle peg selection. Talks about the importance of separating Model logic from UI presentation. The CodeBreaker becomes a fully playable game by the end.
Paul Hegarty is a Lecturer who has been teaching CS193p at Stanford since 2010.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: