Created
September 2, 2019 05:06
-
-
Save badrinathvm/f9424c4aec68ba106422640ed8cc76c4 to your computer and use it in GitHub Desktop.
Animate by considering the height Constraint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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