๐Ÿ”ฐLayout

SwiftUI layout system:

  1. Parent proposes a size for child.

  2. Child chooses its own size.

  3. Parent places child in parentโ€™s coordinate space.

SwiftUI views manage size in different ways:

  • "push-out" views: expand to fill space offered by parent. ๐Ÿ‘‰Color, LinearGradient, Circle...

  • "pull-in" views: have ideal size that varies according to their contents. ๐Ÿ‘‰ Text , container views (HStack, VStack , ...)

  • "fixed" views: have ideal size that never varies. ๐Ÿ‘‰ Toggle or DatePicker...

Last updated