IB adds bogus layout constraint for view controllers with non-default simulated freeform sizes

Originator:dr.eric.roller
Number:rdar://35474983 Date Originated:11/10/2017
Status:Open Resolved:
Product:Xcode Product Version:9.2 beta (9C34b)
Classification:Bug Reproducible:Always
 
Summary:
The attached storyboard contains two examples of a collection view controller. The only difference between the two controllers is that the first one (Freeform 378 x 667) used a simulated "Freeform" size with default values. In the second controller (Freeform 320 x 667) the simulated size of the controller was manually set to a width of 320.

For the controller with the reduced freeform width, Xcode highlights a conflicting layout constraint issue even though none of the constraints have been changed. When inspecting the details of the conflicting constraints, Xcode lists a new, bogus constraint "width = 0" which is not a constraint that exists on the button object. In fact, in the resolution dialog, this bogus width constraint cannot be selected for deletion; it doesn't exist!


Steps to Reproduce:
1) Create a collection view controller in IB,
2) Insert a button into the collection view cell,
3) Add layout constraints for top, leading, trailing, and bottom of the button with respect to its superview,
4) There should be no width or height constraint for the button,
5) In the inspector pane of the view controller, change the "Simulated Size" to "Freeform" and reduce the default width, e.g. from 378 to 320,
6) Observe that a "conflicting constraint" error icon appears in the view list (see error_icon_appears.png attachment),
7) Click the error icon to inspect the conflicting layout constraints,
8) A bogus "width = 0" constraint has been added (see conflicting_constraints.png attachment).

Expected Results:
Instead of 6) no conflicting layout constraints issues should appear.

Actual Results:
6) and 8) above.

Version/Build:
Xcode Version 9.2 beta (9C34b)
macOS 10.13.1 (17B48)

N.B. First observed in Xcode 9.1 beta.

Configuration:
n/a

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!