Trailing constraint is missing error

It's telling you that your labels on the left may intersect with your switches on the right. You need to give your labels a constraint telling them how far they should be from the switches.

You can either give your labels a variable width/set distance I.E. set right constraint from switch. Or you could do a set width/variable distance from the switch by clicking on the label, giving it a right constraint from switch and then making that constraint less than or equal to some value by clicking on the constraint and changing the relation setting.

Another option is to align all your labels with a trailing constraint and then you only have to tell one label how it should constrain to the switches and the others will follow.

EDIT: Another option is to add both the label and corresponding switch to a stack view by selecting both and clicking on the button to the left of the align constraint button. Then horizontally align the stack view, give the stack view a left, right and either top or bottom constraint and that should also fix it. (This is probably what I would do myself).

StackView Example:

StackViewExample

As you can see, clicking the highlighted button makes a stackview that holds child views.

Set Distance and Align Trailing Example:

enter image description here


Xcode 13.3

A nice little workaround for this type of constraints (if you just want them to disappear) is to create a missing constraint (for leading or trailing edge) and then edit it's relation and constant to "greater or equal to 0". This way you can be sure that it won't mess up your view and the warning will disappear:

In this example GPS Logout is missing it's trailing constraint:

enter image description here

Add a missing constraint with the suggested value:

enter image description here

The warning will disappear, but to make sure that this constraint won't affect the view no matter the screen size you can edit it's constant and relation to >= 0

enter image description here