โš ๏ธ Fixed leading and trailing constraints may cause clipping

Rui AurelianoRui Aureliano
1 min read

When using storyboard and auto-layout we see sometimes this warning

1.png

So what does this means? after some digging this seems to happen when using components with text, and seems to be related to localization.

So I made this simple sample, just a UIView with padding of 100px and a UILabel with padding of 50px

2.png

And there is the warning ๐Ÿ˜ก

โš ๏ธ warning: Auto Layout Localization: Fixed leading and trailing constraints may cause clipping, one of them should have a constant โ‰ฅ standard space.

The message is self-explanatory, it's related to leading and/or trailing for this particular UILabel, the suggestion is to use โ‰ฅ, which breaks this sample.

3.png

To fix this (not 100% of the implications for other languages), but for the leading and trailing just remove the option for Respect Language Direction.

Select the leading constraint, and for Attributes Inspector, select the dropdown and remove the option for Respect Language Direction. After that, you should see LABEL.left instead of LABEL.leading

4.png

Done, no more warnings ๐Ÿ’ช

0
Subscribe to my newsletter

Read articles from Rui Aureliano directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rui Aureliano
Rui Aureliano

๐Ÿ‘‹ Hi, I'm Rui Aureliano. ๐Ÿ›  In my spare time, I build Sip.