⚠️ Fixed leading and trailing constraints may cause clipping
1 min read
When using storyboard and auto-layout we see sometimes this warning
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
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.
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
Done, no more warnings 💪