Skip to content

Instantly share code, notes, and snippets.

@badrinathvm
Created September 2, 2019 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badrinathvm/f9424c4aec68ba106422640ed8cc76c4 to your computer and use it in GitHub Desktop.
Save badrinathvm/f9424c4aec68ba106422640ed8cc76c4 to your computer and use it in GitHub Desktop.
Animate by considering the height Constraint
func animate() {
let screenSize = UIScreen.main.bounds
let heightValue = screenSize.size.height / 2
self.view.layoutIfNeeded()
UIView.animate(withDuration: 1.0, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 1.0, options: UIView.AnimationOptions.curveEaseIn, animations: {
self.notchBottomConstraint.constant = -heightValue
self.heightConstraint.constant = heightValue
self.view.layoutIfNeeded()
}, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment