4

I have no idea how to set constrant.height to constant value:

override func updateConstraints() {
    layout(view) { view in
        let viewHeight = 67

        view.top == view.superview!.top
        view.left == view.superview!.left
        view.height == viewHeight // Error: Binary operator '==' cannot be applied to operands of type 'Dimension' and 'Int'
        view.width == view.superview!.width
    }

    super.updateConstraints()
}

This should be simple, put as a Swift newbie atm I don't have any working idea, would welcome any help :)

Nat
  • 12,032
  • 9
  • 56
  • 103

1 Answers1

8

You probably solved this one by yourself, but for anybody else it seems that the ==-operator is not overloaded for Int. So changing the definition of your variable to:

let viewHeight: CGFloat = 67

will do the trick.

greg
  • 132
  • 8
  • I've resigned from Cartography as there were troubles with topLayoutGuide, which I couldn't fix with it. So I'm accepting your solution (it sounds valid) but did not (and will not) test it ;). – Nat Aug 05 '15 at 14:01