Project's Github repository.
So for example, I change this:
let orangeViewCenterXConstraint = NSLayoutConstraint(
item: orangeView,
attribute: .centerX,
relatedBy: .equal,
toItem: view,
attribute: .centerX,
multiplier: 1.0,
constant: 0.0
)
For this:
orangeView.centerXAnchor.constraint(equalTo: view.centerXAnchor)
How is the proper way to do the same with:
let purpleViewBottomSpaceConstraint = NSLayoutConstraint(
item: purpleView,
attribute: .bottom,
relatedBy: .equal,
toItem: orangeView,
attribute: .top,
multiplier: 1.0,
constant: -8.0
)
I tried with:
purpleView.bottomAnchor.constraint(equalTo: <#T##NSLayoutAnchor<AnyObject>#>, constant: <#T##CGFloat#>)
But I think purpleView
needs a space between purpleView
and orangeView
, so technically equalTo: orangeView
, constant: -8.0
, but this is wrong.
I'm not sure of what I'm currently doing, so I'm here to learn.