Skip to main content Skip to secondary navigation

2023

Main content start

The 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.

Screen Capture of First Application
Lecture 1

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.

Watch Video/Screen Capture

Reading Assignment 1

Graphic of MVVM Architecture
Lecture 3

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.

Watch Screen Capture

Screen Capture of fully-functional Memorize application
Lecture 4

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.

Watch Screen Capture

Reading Assignment 2

Warning about lack of conformance to Identifiable protocol.
Lecture 5

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.

Watch Screen Capture

Programming Assignment 2

Cardify ViewModifier code.
Lecture 7

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.

Watch Screen Capture

Cardify.swift

Pie.swift

Animated card flipping.
Lecture 8

Animation (Part 1)

First of a two-part animation adventure. Implicit animation vs. explicit animation. Animation curves. Animating a ViewModifier (flipping cards).

Watch Screen Capture

Reading Assignment 4

Flying Score Animation
Lecture 9

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).

Watch Screen Capture

Programming Assignment 4

Memorize

Emoji Art in Action
Lecture 10

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.

Watch Screen Capture

Emoji Art L10

Resizing Emoji Art Document
Lecture 11

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).

Watch Screen Capture

Programming Assignment 5

EmojiArt L11

Slides
Lecture 12

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.

Watch Screen Capture

EmojiArt L12

Navigating thru Views
Lecture 13

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.

Watch Screen Capture

Programming Assignment 6

EmojiArt L13

asynchronous code
Lecture 14

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.

Watch Screen Capture

EmojiArt L14

Multiple Windows in Emoji Art
Lecture 15

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!

Watch Screen Capture

EmojiArt L15