2023
Main content startThe lectures for the Spring 2023 version of Stanford University's course CS193p (Developing Applications for iOS using SwiftUI) were given in person but, unfortunately, were not video recorded. However, we did capture the laptop screen of the presentations and demos as well as the associated audio. You can watch these screen captures using the links below. You'll also find links to supporting material that was distributed to students during the quarter (homework, demo code, etc.).
The curriculum is substantially similar to the Spring 2021 version, so if you have already watched that, you might find L14 to be the most interesting (actor-based async programming). Note also that WWDC 2023 has come and gone and the change introduced there that probably affects the curriculum below the most is the update made to the reactive UI mechanism in SwiftUI (@Observable versus ObservableObject). Presumably ObservableObject will be backwards-compatible for a while, but starting with Xcode 15/iOS 17, you'll likely want to move to using @Observable.
For more, check out the About page.
Getting Started with SwiftUI
Introduction to the course. The basics of SwiftUI. Start working on the first application of the quarter, a card-matching game called Memorize. This will be the foundation for the first few weeks of course material.
More SwiftUI
Development on Memorize continues. Creating custom Views. Handling a tap gesture. Adding buttons. Factoring shared code.
MVVM
Conceptual overview of the architectural paradigm underlying the development of applications for iOS using SwiftUI (known as MVVM). Explanation of a fundamental component of understanding the Swift programming language: its type system. Start to apply both of these to Memorize.
Applying MVVM
Apply the MVVM architecture to the Memorize application. Along the way, gain familiarity with Generics and an understanding of type (static) variables and functions.
Protocols, enum, Optional
The primary topic is protocols (Identifiable, Equatable, etc.). In addition, another significant element of the Swift type system, enum, is introduced along with the most important enum in Swift: Optional. The logic of Memorize is finished off using these along with computed properties.
Layout, @ViewBuilder
How does SwiftUI lay out its views given the real estate available to it? And how can we create our own "layout engine" views? Update Memorize to lay out its cards most efficiently.
Shape, ViewModifier, Constants
How to draw shapes in SwiftUI (e.g. a "pie" shape needed for a future Memorize feature). How to create custom ViewModifiers (e.g. one that "card-ifies" any view, not just our Memorize game card). Along the way, introduce a formalism for cleanly adding constants to our code.
Animation (Part 1)
First of a two-part animation adventure. Implicit animation vs. explicit animation. Animation curves. Animating a ViewModifier (flipping cards).
Animation (Part 2)
Kicking off animations when views appear (flying score updates). Animating changes to state via TimelineView (the "bonus scoring" pie). Animating view transitions to/from screen and matching the geometry of those views (the dealing out of Memorize cards).
Emoji Art
Create an iPad application from scratch: Emoji Art. This is an opportunity to review MVVM since this application has an entirely different architecture from Memorize. It uses SwiftUI's drag and drop mechanism to set the Emoji Art document's background and to add emojis to the works of art you can create with it.
Gestures, 2nd MVVM
Handling multitouch gestures (zooming and panning Emoji Art documents). Start to build more complex applications by adding a second MVVM construction to an application (Emoji Art's emoji palettes).
Persistence, Property Wrappers
Make information persist between launches of an application. Emoji Art saves its document and also any changes made to its palettes. Understanding more about how property wrappers (e.g. @State, @Published, etc.) work.
Presenting Views, Navigation
So far our two applications have only each been made of a single, main "content view" (our Memorize game view or Emoji Art document view). More complex applications need to present multiple different kinds of Views. Add mechanisms to Emoji Art to edit its palettes by presenting popovers, modal sheets, etc., and navigation between views.
Multithreading, Error Handling
Mobile application UIs need to always be responsive even though they may do things that can take a (relatively) long time (like downloading something from the internet). The Swift language has an integrated mechanism for making it clear which things need to happen "in the background" so as not to slow down the UI. Handling unexpected errors is also important while doing this, so both topics are presented together in this lecture.
Document Architecture
Emoji Art of course wants to support having multiple documents (both side-by-side in iPad and in multiple windows on the Mac). SwiftUI has a powerful built-in UI for handling this and, along the way, we'll get support for undo/redo in Emoji Art!