Lecture 4: Memorize Game Logic
YouTube Viewers YouTube Viewers
1.9M subscribers
117,545 views
0

 Published On Premiered May 24, 2021

The series of video lectures given to Stanford University students in Spring of 2021 continues by completing the MVVM architecture in the Memorize demo by using the ViewModel to build the View. Swift’s powerful enumeration syntax is introduced, along with the specific enum Optional. The lecture concludes with using the Optional construct in Memorize as part of finishing off its game logic.

The Swift Programming Language’s semantics for enumerations is particularly powerful and contrasts with many of the languages taught in introductory Stanford computer science courses. Enumerations in Swift allow for storing data in each matching case, creating helper methods directly on the enumeration, pattern-matching in switch statements, and more. Furthermore, a vast number of standard Swift libraries utilize the enumeration Optional in their functionality, and the Swift Programming Language adds useful syntax for manipulating Optionals. Optionals also find use in graceful error-handling when an operation may or may not succeed in returning a desired value. This is applied directly in Memorize in the final demonstration, and the lecture concludes with the major features of Memorize in a working state.

show more

Share/Embed