Wednesday, October 26, 2016

Animating a Constraint

You want to animate the "layoutIfNeeded()" function after setting the constant on the constraint.
 
centerXConstraint.constant = 0

UIView.animate(withDuration: 0.2) {
    self.view.layoutIfNeeded()
}
 
(Xcode 8, Swift 3.0)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

SwiftUI Search & Filter with Combine - Part 3 (iOS, Xcode 13, SwiftUI, 2...

In part 3 of the Searchable video series, I show you how to use Combine in #SwiftUI for the search and filter logic connected to the searcha...