> On Mar 22, 2016, at 8:49 PM, Brent Royal-Gordon via swift-evolution 
> <[email protected]> wrote:
> 
> So, today is day 2 of Swift 2.2 being in the hands of mere mortals. This 
> evening, I walked into my weekly NSCoder Night meeting and talked to a pretty 
> experienced developer struggling with this:
> 
>       class EditEventViewController: UIViewController {
>               ...
>               @IBAction func cancel(sender: AnyObject?) {
>                       cancel()
>               }
>               func cancel() {
>                       // actual canceling logic is here
>               }
>       }
>       
>       class EditEventContainerViewController: UIViewController {
>               ...
>               func prepareForSegue(_ segue: UIStoryboardSegue, sender sender: 
> AnyObject?) {
>                       switch segue.identifier {
>                               ...
>                               let cancelButton = 
> UIBarButtonItem(barButtonSystemItem: .Cancel, target: nil, action: nil)
>                               cancelButton.target = vc
>                               cancelButton.action = #selector(vc.cancel)      
> // This is the problem line
>                               ...
>                       }
>               }
>       }
>               
> `vc.cancel` was, of course, ambiguous, and the SE-0021 `vc.cancel(_:)` syntax 
> can't select a Void function. I had to explain how to use `as Void -> Void` 
> to select the right version.
> 
> This is merely an anecdote, but I think it may end up being an issue.

Thanks for reporting this. I also saw this come up at least one other place:

https://twitter.com/bendodson/status/712208662933200896

I wonder if it's worth making #selector(vc.cancel()) work. What do you think, 
Doug?

-Joe
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to