The series of video lectures given to Stanford University students in Spring of 2020 continues with a conceptual overview of the architectural paradigm underlying the development of applications for iOS: MVVM. In addition a key concept in the Swift Programming Language, its type system, is explained. The Memorize demonstration continues, incorporating MVVM.
It is impossible to develop applications for iOS using SwiftUI without using the MVVM architecture for organizing your code. This lecture explains what that is and then demonstrates how it works in our demonstration application. SwiftUI development happens entirely in the programming language Swift. Swift is unique in its support of most modern language features, including both object-oriented programming and functional programming. Since functional programming is new to most Stanford students, this lecture starts the process of explaining how it works by covering the basics of Swift’s type system, including structs and classes, generics and functions as types. The demonstration then moves to the next level using the MVVM architecture (including creating a Model, a ViewModel, expressing user’s intent from the View) and utilizing Swift features like generics and functions as types. After this lecture, students take over the development of Memorize for their first assignment.
Archived course materials (homework assignments and lecture slides) are available at https://cs193p.stanford.edu.