ContentMode
public enum ContentMode : Equatable
Represents how the content should size itself relative to its parent.
-
The content will be sized to fill its parent while maintaining the specified aspect ratio.
In
legacy
layout mode, if the parent is unconstrained in all dimensions, the content size will be used for measurement and will behave likefitContent
. If the parent is unconstrained in one dimension, the element will fill the constrained dimension.In
caffeinated
, if the parent is unconstrained in any dimension, this element will report a size ofinfinity
.Declaration
Swift
case fillParent
-
The content will be sized to fit within its parent while maintaining the specified aspect ratio.
If the parent is unconstrained in one dimension, the element will fit the constrained dimension.
In
legacy
layout mode, if the parent is unconstrained in all dimensions, the content size will be used for measurement and will behave likefitContent
.In
caffeinated
layout mode, if the parent is unconstrained in both dimensions, this element will report a size ofinfinity
.Declaration
Swift
case fitParent
-
The content will grow in whichever dimension is needed to maintain the aspect ratio, while ensuring the content still fits.
This mode does not take the parents applied size constraint into account, so the parent may ultimately layout the element without the constrained aspect ratio.
Declaration
Swift
case fitContent
-
The content will shrink in whichever dimension is needed to maintain the aspect ratio, meaning it may be smaller in one dimension than the measured size.
This mode does not take the parents applied size constraint into account, so the parent may ultimately layout the element without the constrained aspect ratio.
Declaration
Swift
case shrinkContent