Skip to content

Instantly share code, notes, and snippets.

@yabenatti
Created November 10, 2017 16:30
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 yabenatti/6442cc4ffcd2e562d1fe1f2a1f9387ed to your computer and use it in GitHub Desktop.
Save yabenatti/6442cc4ffcd2e562d1fe1f2a1f9387ed to your computer and use it in GitHub Desktop.
DelegateTutorialSecondViewController
import UIKit
protocol SecondViewControllerProtocol {
func didDoSomethingOnSecondViewController(message: String)
}
class SecondViewController: UIViewController {
//MARK: - Variables
var delegate: SecondViewControllerProtocol?
//MARK: - IBActions
@IBAction func didTapCTAButton(_ sender: Any) {
self.navigationController?.popViewController(animated: true)
self.delegate?.didDoSomethingOnSecondViewController(message: "Sending message back to FirstViewController")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment