I am looking at the SnapKit documentation: http://snapkit.io/docs/
If you go to the usage section it has the following example code:
let box = UIView()
superview.addSubview(box)
box.snp_makeConstraints { (make) -> Void in
make.top.equalTo(superview).offset(20)
make.left.equalTo(superview).offset(20)
make.bottom.equalTo(superview).offset(-20)
make.right.equalTo(superview).offset(-20)
}
to make a box that is constrained to its superview's edges with 20pts of padding.
I tried doing this in my own project:
thankYouMessage.snp_makeConstraints { (make) -> Void in
make.right.left.top.equalTo(superview)
make.height.equalTo(self.view.frame.height * 0.2)
}
However in Xcode it says "unresolved use of identifier superview".
What is the problem?
thankYouMessage.snp.makeConstraints { make in
make.right.left.top.equalToSuperview()
make.height.equalToSuperview().multipliedBy(0.2) // or .dividedBy(5)
}