Deepwatch

Keyboard shortcuts

Space or k
Play or pause
j and l
Back or forward 10 seconds
Left and right arrows
Back or forward 5 seconds
f
Fullscreen
m
Mute or unmute
Shift and < or >
Slower or faster
n
Next lecture
?
Show or hide this list

Stanford CS193p: iOS Development with SwiftUI | 2025 | L6: Demonstrating Data Flow

Stanford Online, 1 hr 15, 12.5K views, Nov 25, 2025

Show description

View course details: https://online.stanford.edu/courses/cs193p-ios-application-development All course materials are available at https://cs193p.stanford.edu. The 6th lecture of the 2025 version of Stanford's CS193p course (developing applications for iOS using SwiftUI). This lecture is entirely demo-focused, covering advanced data flow patterns in SwiftUI. Implements a peg chooser keyboard interface to improve user input beyond the tap-to-cycle method. Key topics include: file organization with extract-to-file refactoring, creating PegView as a reusable component, using // MARK comments for code organization, implementing @State for selection tracking, and creating Buttons with custom Views as labels. Demonstrates data flow from user input through View interactions to Model updates, showing how Views become visual manifestations of Model state. Introduces ForEach without indices when data is unique, an extension to add custom Color.gray() function with brightness parameters, and the difference between CGFloat (for drawing) and Double (for general math). The implementation shows practical SwiftUI patterns like trailing closure syntax with multiple closures, guard statements for defensive programming, and proper @State management for UI state that doesn't belong in the Model. Paul Hegarty is a Lecturer who has been teaching CS193p at Stanford since 2010.