Lecture 4: Grid + enum + Optionals

in hive-196037 •  4 years ago 


The fourth video lecture given to Stanford students in Spring quarter of 2020 continues the Memorize demo by enhancing significantly the arrangement of the cards by creating our own container View called Grid (which also involves a number of basic functional programming concepts). Two more important Swift language features are discussed (enum and Optionals). And we finally get Memorize playing the card matching game itself (prominently featuring Optionals in our implementation).

The survey of the Swift type system completes with a discussion of enum, a data structure with more functionality built into it than students are used to from other languages. While the reading assignments in this course are the primary way students learned the Swift language, occasionally a very important feature of the language is highlighted in lecture, as in this lecture where Optionals are explained in detail and then extensively demonstrated as we use them prominently in our implementation of the full game logic for Memorize in our Model.


▶️ DTube
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!