How do i check if two constraints are the same using swift

394 Views Asked by At

I am trying to write a test to check if the location of a stack view is where I expect it to be. In code I've set the stack view bottomAnchor = to the superview.bottomAnchor (using the appropriate method). I've written the following assertion in my test case:

func test_MainMenu_At_BottomLeft () {
    let vcv = ViewController().view
    let sv = ViewController().view.subviews[0]

    XCTAssert(vcv.bottomAnchor == sv.bottomAnchor)
}

It always fails. I've tried casting to CGFloat, creating other temporary anchors but all of it pointless. There doesn't seem to be any properties of bottomAnchor that I could use. The stack view is laid out correctly and the build passes with no issues.

Any suggestions?

0

There are 0 best solutions below