Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- self.showAlertWithButtonClicked(clickedButton: { (clickedButton) -> Void in
- //check the button index by clickedButton.tag
- })
- class MyAlertController: UIViewController {
- typealias CompletionHandler = (_ clickedButton: UIButton) -> Void
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- }
- func showAlertWithButtonClicked(clickedButton: @escaping (MultipleMethodRunningHandle)) {
- //Do what you want
- }
- func pressedCancelButton(button: UIButton) {
- //At this point compiler doesn't allow me to use that completionHandler globally in the class
- button.tag = 0
- clickedButton(button)
- }
- func pressedSendButton(button: UIButton) {
- //At this point compiler doesn't allow me to use that completionHandler globally in the class
- button.tag = 1
- clickedButton(button)
- }
- func pressedAddButton(button: UIButton) {
- //At this point compiler doesn't allow me to use that completionHandler globally in the class
- button.tag = 2
- clickedButton(button)
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement