Update the constant of a constraint programmatically in Swift

self.view.layoutIfNeeded()
UIView.animateWithDuration(1, animations: {
self.sampleConstraint.constant = 20
self.view.layoutIfNeeded()
})