Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you know where’s the Vary for Traits in Xcode 13?

Tags:

xcode13

I can't find Vary for Traits in Xcode 13. Thanks in advance for any help!

like image 746
Michel Odreman Avatar asked Oct 14 '22 19:10

Michel Odreman


2 Answers

You can set Trait specific variations in the Attributes and Size Inspector panes.

For example, suppose we have this layout:

enter image description here

with Stack View properties:

enter image description here

But -- when we have a Regular Width trait, we want it to look like this:

enter image description here

with these Stack View properties:

enter image description here

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:

enter image description here

When we click the Add Variation button, we'll see a new wR variation where we can select Horizontal:

enter image description here

Now click the + to the left of Spacing and again select Width -> Regular / Height -> Any:

enter image description here

When we click the Add Variation button, we'll see a new wR variation where we can change 8 to 32:

enter image description here

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:

enter image description here

When we click the Add Variation button, we'll see a new wR variation where we can change 120 to 64:

enter image description here

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.

like image 138
DonMag Avatar answered Oct 23 '22 06:10

DonMag


You can Introduce any variations in Layout Constraints

enter image description here

like image 36
Iurii Avatar answered Oct 23 '22 06:10

Iurii