Lecture 5: Properties Layout @ViewBuilder

Lecture 5: Properties Layout @ViewBuilder

82.487 Lượt nghe
Lecture 5: Properties Layout @ViewBuilder
Video 5 of the SwiftUI development lecture series given at Stanford during the Spring quarter of 2021 starts off by redefining the need and use cases for @State, while more specifically explaining its memory usage. More broadly in this lecture, the concept of properties is expanded to include computed properties and property observers. We then move on to the next major topic: the architecture for laying Views out on screen. This includes more details about combiner Views, some tools to modify a View's layout such as GeometryReader, overlay, and background, along with the @ViewBuilder directive which provides syntactical support for building (sometimes conditional) lists of Views. Many of these are demonstrated in the Memorize game by automatically sizing the game’s emoji font to fit the available space. Along the way, the “access control” on the internal APIs of Memorize is tightened up and numerous XCode features such as rename and fold are demonstrated.