Two height constraints?

After I update the height of my view I get the following error message in the console:

2022-03-23 18:38:35.093236+0100 Moiree[10522:931302] [Layout] Unable to simultaneously satisfy constraints:
(
    "<NSLayoutConstraint:0x61000008c3f0 NSView:0x6080001201e0.height == 2280   (active)>",
    "<NSLayoutConstraint:0x61800008ae60 NSView:0x6080001201e0.height == 2760   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x61800008ae60 NSView:0x6080001201e0.height == 2760   (active)>

How can there be two different height constraints? I set the height with

self.heightAnchor.constraint(equalToConstant: newValue)

Shouldn't that just update the height constraint that is already there?

Thanks and regards, Sebastian

Replies

Whopsie, solved it.

heightAnchor.constraint() creates a new constraint.

Use removeConstraint() beforehand and it works fine.