I am trying to add a subview in my Swift 3 tableView
. I want the leading anchor to be related to 0.05 x the width of my parent view( tableView
).
When I write the following:
modalView.leadingAnchor.constraint(equalTo:margins.widthAnchor, constant: 0.05).isActive = true
I get
Cannot convert value of type 'NSLayoutDimension' to expected argument type 'NSLayoutAnchor<NSLayoutXAxisAnchor>'
How can I create the desired leading constraint using NSLayoutAnchor
?
Try to use the following code: