Last active
July 18, 2017 05:05
-
-
Save mayooresan/339d0ff0314f13bc0cbaed41cc4b90d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
//dismiss the modal | |
dismiss(animated: true, completion: nil) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment