Skip to content

Order of operation when creating constraint #71

Open
@BrianSemiglia

Description

@BrianSemiglia
// Context
let view1 = UIView()
let view2 = UIView()
let window = UIWindow()
window.addSubview(view1)
window.addSubview(view2)
view1.widthAnchor == 50
view2.widthAnchor == (view1.widthAnchor + 150) / 2
// Expectation: (50 + 150) / 2
view2.frame.width == 100
// Actual: (50 / 2) + 150
// <NSLayoutConstraint: UIView.height == 0.5 * UIView.height + 150   (active)>
view2.frame.width == 175

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions