SnapKit
SnapKit copied to clipboard
Error: Cannot assign value of type 'ConstraintMakerEditable' to type 'Constraint?' when following docs
New Issue Checklist
- [x] I have looked at the Documentation
- [x] I have read the F.A.Q.
- [x] I have filled out this issue template.
Issue Info
| Info | Value |
|---|---|
| Platform | iOS |
| Platform Version | 11 |
| SnapKit Version | 4.0.0 |
| Integration Method | cocoapods |
Issue Description
Following the docs to create a reusable (updatable and uninstallable) constraint. I get the following error:
Cannot assign value of type 'ConstraintMakerEditable' to type 'Constraint?'
This this bit of code:
var destinationAddressViewBottom: Constraint? = nil
destinationAddressViewBottom = make.bottom
.equalTo(titleBackgroundView.snp.bottom)
.offset(-16)
Hello, I think you are forgetting the tail of the expression to get the Constraint object out of it (.constraint), such as:
destinationAddressViewBottom = make.bottom
.equalTo(titleBackgroundView.snp.bottom)
.offset(-16).constraint
Wow that is easy to miss!!
Raywenderlich's tutorial also misses this part