mercredi 10 août 2016

Add static parameter to #selector in Swift

Is it possible to pass an int variable via a selector, e.g. #selector(run(1)) or #selector(run(2))

More context if necessary:

   let button = UIBarButtonItem(title: "Run",
                                       style: UIBarButtonItemStyle.Plain,
                                       target: self,
                                       action: #selector(run(1)))

Aucun commentaire:

Enregistrer un commentaire