'Update constraint does not work on UITableView snapkit

When I try to update the snapkit constraint right after making the constraint I get aUpdated constraint could not find existing matching constraint to update error. The code I am using is below:

let directionList = UITableView()
directionList.delegate = self
directionList.dataSource = self
directionList.tag = DIRECTIONS_TABLE_TAG
self.view.addSubview(directionList)
directionList.snp.makeConstraints{ (make) -> Void in
    make.width.equalToSuperview()
    make.top.equalTo(self.view.snp.bottom)
    make.left.equalToSuperview()
    make.right.equalToSuperview()
    make.bottom.equalToSuperview().offset(-20)
}

directionList.snp.updateConstraints { (make) -> Void in
   make.top.equalTo(self.topDarkBlue.snp.bottom)
}


Solution 1:[1]

I'm late but might be helpful for someone, top answer has one mistake

Change line

topConstraint = make.top.equalTo(self.view.snp.bottom)

to

topConstraint = make.top.equalTo(self.view.snp.bottom).constraints

and one more thing

topConstraint.deactivate()

because uninstall has deprecated.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mudassir