Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import UIKit
class FirstViewController: UIViewController, SecondViewControllerProtocol {
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "FirstToSecondSegue" {
if let vc = segue.destination as? SecondViewControllerProtocol {
vc.delegate = self
//MARK: - SecondViewControllerDelegate
func didDoSomethingOnSecondViewController(message: String) {
let alert = UIAlertController(title: "Delegate", message: "\(message)", preferredStyle: .alert)
let action = UIAlertAction(title: "OK", style: .cancel, handler: nil);
self.present(alert, animated: true, completion: nil)
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.