Last active
December 23, 2016 09:00
-
-
Save andresbrun/db8b70f9ac0894a8d7227b866c0c2be8 to your computer and use it in GitHub Desktop.
Shows how to add a collision behaviour
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
let collisionBehaviour = UICollisionBehavior(items: [targetView]) | |
animator.addBehavior(collisionBehaviour) | |
// Collision with bounds of superview | |
collisionBehaviour.setTranslatesReferenceBoundsIntoBoundary(with: .zero) | |
// Collision with custom boundaries | |
collisionBehaviour.addBoundary(withIdentifier: "barrier" as NSCopying, | |
for: UIBezierPath(ovalIn: containerView.bounds)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment