# Session 237 - Building Custom Views with SwiftUI ###### tags: `WWDC-2019` `SwiftUI` https://developer.apple.com/wwdc19/237 - Layout Procedure - Parent proposes a size for child - **Child chooses its own size** - Parent places child in parent's coordinate space - SwiftUI rounds coordinates to nearest pixel - `Frame` is not a constraint in SwiftUI, it's just a `view` - SwiftUI handle RTL for you - HStack & VStack - view 可以設定 `layoutPriority()` 讓它不會被截斷 - alignment 有很多可以調整的地方,甚至可以自訂新的 alignment - 可以自訂 struct 符合 `ViewModifier` - `drawInGroup()` 可以把裡頭的 sub view 都合併到一個 view 裡,提高繪圖效率 --- All customization centers on View - Layout - Graphics - Animation and transitions - Interaction 一個 view 就像是一個小型的、自給自足的 view controller