Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placeholder Remove at build time constraints

Xcode Interface Builder has the checkbox "Placeholder - Remove at build time" within the Attributes Inspector of a autolayout constraint.

IB Size Inspector screenshot

I googled but could not find a satisfactory answer.

  • What is a "Placeholder" constraint?
  • What does "Remove at build time" mean?
  • Why is this useful? (An example would be helpful)
like image 328
Shourob Datta Avatar asked Nov 28 '18 06:11

Shourob Datta


People also ask

How do I change constraints in Xcode?

Clicking the Edit button in any of the constraints brings up a popover where you can change the constraint's relationship, constant, priority, or multiplier. To make additional changes, double-click the constraint to select it and open it in the Attribute inspector.

What is constraint to margin?

By unchecking "constraints to margin", you are adding constraints, meaning your interface will react correctly to changes in size or orientation.


1 Answers

The "Remove at build time" option allows you to provide a Placeholder constraint for a view.

For example, suppose you are calculating the view's height and then applying a constraint programmatically, then there might be possibility of having a compile time error in the interface builder that you haven't provided view's height constraint that was expected.

But if you provide a placeholder height (by using 'remove at build time' option) while designing a view in the interface builder then it will not show an error and remove this placeholder constraint as soon as the interface builder builds.

like image 111
nikksindia Avatar answered Sep 30 '22 07:09

nikksindia