Skip to content

Instantly share code, notes, and snippets.

@adamgraham
Last active May 18, 2019 03:16
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 adamgraham/45b9318260cf0a40ed60e86059525bc5 to your computer and use it in GitHub Desktop.
Save adamgraham/45b9318260cf0a40ed60e86059525bc5 to your computer and use it in GitHub Desktop.
An @IBDesignable iOS class that can be used in Interface Builder as a custom segue to dismiss a modally presented view controller.
@IBDesignable class DismissSegue: UIStoryboardSegue {
var completion: (() -> Void)?
override func perform() {
self.source.presentingViewController?.dismiss(animated: UIView.areAnimationsEnabled, completion: self.completion)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment