Skip to content

Instantly share code, notes, and snippets.

@mayooresan
Created July 18, 2017 04:51
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 mayooresan/60581f5cca9816ec4b24284d6dcd43c7 to your computer and use it in GitHub Desktop.
Save mayooresan/60581f5cca9816ec4b24284d6dcd43c7 to your computer and use it in GitHub Desktop.
import UIKit
protocol SpyDelegate {
func didFindWeaponOfMassDestruction(found : Bool)
}
class EnemyBaseVC: UIViewController {
let hasWeaponOfMassDescrtruction : Bool = true
var delegate : SpyDelegate?
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func sendingMessage(_ sender: Any) {
// if delegate is nil then the app will crash
// so you must do this check
if delegate != nil {
delegate?.didFindWeaponOfMassDestruction(found: hasWeaponOfMassDescrtruction)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment