Created
January 2, 2017 18:25
-
-
Save andresbrun/771dcc8ebf8e8672b7916c68840b52e4 to your computer and use it in GitHub Desktop.
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
modalViewExitBehaviour = UIDynamicItemBehavior(items: [targetView]) | |
// Action is called in every animation step | |
modalViewExitBehaviour.action = { [unowned self] _ in | |
// Check if all views are outside of the reference frame | |
if !self.allViews.contains(where: { $0.frame.intersects(self.superview.bounds) }) { | |
self.onDismiss?() | |
} | |
} | |
animator?.addBehavior(modalViewExitBehaviour) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment