I can't find Vary for Traits in Xcode 13. Thanks in advance for any help!
You can set Trait specific variations in the Attributes and Size Inspector panes.
For example, suppose we have this layout:
with Stack View properties:
But -- when we have a Regular Width trait, we want it to look like this:
with these Stack View properties:
Switch back to our original layout (Vertical stack view, spacing: 8, Height: 120).
Select the stack view, and in the Attributes Inspector pane, click the +
button to the left of Axis and from the popup select Width -> Regular
/ Height -> Any
:
When we click the Add Variation
button, we'll see a new wR
variation where we can select Horizontal
:
Now click the +
to the left of Spacing and again select Width -> Regular
/ Height -> Any
:
When we click the Add Variation
button, we'll see a new wR
variation where we can change 8
to 32
:
Now we select the Height constraint, and in the Size panel click the +
to the left of Constant and again select Width -> Regular
/ Height -> Any
:
When we click the Add Variation
button, we'll see a new wR
variation where we can change 120
to 64
:
Now when we switch the orientation in Storyboard / Interface Builder (and when we rotate the device at run-time), we'll get our desired result.
You can Introduce any variations in Layout Constraints
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With