Lecture 5: ViewBuilder + Shape + ViewModifier

The fifth iOS lecture given at Stanford during Spring quarter of 2020 expanded coverage of topics related to drawing on screen including the @ViewBuilder construct for expressing a conditional list of Views, the Shape protocol for custom drawing and ViewModifier, a mechanism for making incremental modifications to Views.

This lecture starts with an aside about access control (marking APIs so that they are revealed to the right “audiences” within an application) which is then applied throughout Memorize. After the Shape protocol is discussed, a “pie shape” is added to the background of Memorize cards in demo in preparation for animating a countdown timer for scoring. A custom ViewModifier is also added to Memorize to “cardify” any View (i.e. make the View appear to be on a card that has a front and a back).


Leave a Comment

We don't require your email address, or your name, for anyone to leave a comment. If you do add an email address, you may be notified if there are replies to your comment - we won't use it for any other purpose. Please make respectful comments, which add value, and avoid personal attacks on others. Links are not allowed in comments - 99% of spam comments, attempt to post links. Please describe where people may find additional information - for example "visit the UN website" or "search Google for..." rather than posting a link. Comments failing to adhere to these guidelines will not be published.