Vary for Traits in Xcode 13 beta?

In the Xcode 13 beta, where's the Vary For Traits button?

Replies

I could not find it either.

I searched for traits in Xcode 13ß Help. And the information shown is not uptodate (it's Xcode 12 or earlier).

That's worth a bug report, at least against Xcode documentation.

Bump. I repeat the question. Xcode 13 is final. I need the Vary For Traits feature. Some of my apps use it. Where is it?

I found this:

h t t p s : / / w w w.reddit.com/r/Xcode/comments/psowtu/vary_for_traits_in_xcode_13/

which shows how to add traits (pretty well hidden):

  • Trait Variations need to be enabled in the File Inspector tab
  • After that you can manually add traits by clicking the plus next to a property (it'll use the active size class but you can modify it while creating too)

I had some issue to find which +it was, I think it is this one:

Hope that helps.

  • Do you have a way to do this with constraints too?

  • You can do this with constraints, but it is extremely confusing. I've filed a bug report, this is crazy that this was removed.

Add a Comment

@idit.b. Is it what you are looking for ?

To all who are still looking for a solution about missing vary for constraints button in Xcode 13, I have created a small YouTube tutorial to explain the way Variations for constraints work in latest Xcode 13.

Missing Vary For Traits Button in Xcode13 https://youtu.be/pZuNhxR_uRg

I hope this will help you to adapt the layout based on different device sizes and the orientation modes. Don't forget to leave a comment on this video and share with others.

Thank you so much. Happy Coding.

  • How do you add trait specific controls to a view controller. i.e a button that only appears own an iPad but not the iPhone.

Add a Comment

The problem I'm finding is that for smaller iPhones like the 13 mini are being grouped into the same size class as larger iPhones like 11 pro max yet they're clearly different. Shouldn't the 13 mini be wC hC? Because mine is showing it to be wC hR... If I set the installed variation of a component to wC hC my component disappears even on the smallest iPhone available because it is seeing the tiny iPhone and large iPhone as wC hR. Kinda defeats the purpose of specifying the class if they're all the same, so I must be doing something wrong here, anyone else having that problem?