Skip to content

Instantly share code, notes, and snippets.

@wotjd
Created February 6, 2020 06:57
Show Gist options
  • Select an option

  • Save wotjd/57ad6b848c0b8d749d6e11ec7377fa9d to your computer and use it in GitHub Desktop.

Select an option

Save wotjd/57ad6b848c0b8d749d6e11ec7377fa9d to your computer and use it in GitHub Desktop.

Revisions

  1. wotjd created this gist Feb 6, 2020.
    24 changes: 24 additions & 0 deletions onDoneBlock.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    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)
    }
    }