SwiftUI โฉ view โฉ layout โฉ size
SwiftUI has built-in views that manage size in different ways:
Expanding to fill the available space (offered by their parent): (Color, LinearGradient, Circle ...)
Color
LinearGradient
Circle
Resizing to fit their content: (have an ideal size that varies according to their contents) (Text, container views ...)
Text
Maintaining a specific size that doesn't change: (have an ideal size that never varies) (Toggle, DatePicker...)
Toggle
DatePicker
Limit the view size
frame(width:height:alignment:)
view hierarchy๏ผparent view proposes a size to the child views it contains, and the child views respond with a computed size.
Differennt type of views have their own space requirements within a container.
Last updated 5 months ago
Was this helpful?