Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.