Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save RaajeevChandran/cc0521bc5da2e7b80cbf890ce81800b5 to your computer and use it in GitHub Desktop.

Select an option

Save RaajeevChandran/cc0521bc5da2e7b80cbf890ce81800b5 to your computer and use it in GitHub Desktop.
private func didInteractionEnd() {
guard let presentedView = presentedView else {
return
}
if let transitioningDelegate = transitioningDelegate {
let dismissFraction = transitioningDelegate.transition.dismissFractionComplete
if dismissFraction > dismissThreshold {
transitioningDelegate.transition.finish()
presentedViewController.dismiss(animated: true)
} else {
transitioningDelegate.transition.cancel()
UIView.animate(withDuration: 0.3) {
presentedView.transform = .identity
}
}
} else {
UIView.animate(withDuration: 0.3) {
presentedView.transform = .identity
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment