Snapkit: Error: Cannot assign value of type 'ConstraintMakerEditable' to type 'Constraint?' when following docs

Created on 12 Feb 2018  路  2Comments  路  Source: SnapKit/SnapKit

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)

Most helpful comment

Hello, I think you are forgetting the tail of the expression to get the Constraint object out of it (.constraint), such as:

var destinationAddressViewBottom: Constraint? = nil destinationAddressViewBottom = make.bottom .equalTo(titleBackgroundView.snp.bottom) .offset(-16).constraint

All 2 comments

Hello, I think you are forgetting the tail of the expression to get the Constraint object out of it (.constraint), such as:

var destinationAddressViewBottom: Constraint? = nil destinationAddressViewBottom = make.bottom .equalTo(titleBackgroundView.snp.bottom) .offset(-16).constraint

Wow that is easy to miss!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MoShenGuo picture MoShenGuo  路  4Comments

lolgear picture lolgear  路  5Comments

semiwhale picture semiwhale  路  3Comments

NicholasTD07 picture NicholasTD07  路  8Comments

seljabali picture seljabali  路  3Comments