Skip to content

Instantly share code, notes, and snippets.

@AppleCEO
Forked from wotjd/onDoneBlock.swift
Created February 6, 2020 07:08
Show Gist options
  • Save AppleCEO/917ac045ffbce48a9e217ae4788c402e to your computer and use it in GitHub Desktop.
Save AppleCEO/917ac045ffbce48a9e217ae4788c402e to your computer and use it in GitHub Desktop.
class ParentViewController: UIViewController {
let button: UIButton()
...
func onTapButton() {
let popupVC = PopupViewController()
popupVC.onDoneBlock = { [weak self] in
self?.moveToNextView()
}
}
func moveToNextView() {
...
}
}
class PopupViewController: UIViewController {
let closeButton: UIButton()
var onDoneBlock: (() -> Void)? = nil
func onTapButton() {
self.dismiss(true, completion: self.onDoneBlock)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment