[swift-evolution] [Idea] Expression to retrieve the Objective-C selector of a method

James Campbell james at supmenow.com
Fri Jan 1 16:57:45 CST 2016


This is a relevant article https://www.mikeash.com/pyblog/friday-qa-2015-12-25-swifty-targetaction.html?utm_campaign=iOS%2BDev%2BWeekly&utm_medium=email&utm_source=iOS_Dev_Weekly_Issue_231

For this topic

Sent from my iPhone

> On 31 Dec 2015, at 01:33, James Campbell <james at supmenow.com> wrote:
> 
> Good point. Not sure if that's replaceable via a protocol or if that Api is just not suited for swift. 
> 
> There is a proposal somewhere to be able to reference swift methods via back ticks a sort of selector for swift so maybe in this case we would use that.
> 
> Sent from my iPhone
> 
>> On 30 Dec 2015, at 20:27, Tino Heth <2th at gmx.de> wrote:
>> 
>> 
>>> I'm not as familiar with OS X but why is it vital there ?
>> 
>>> Do you have an example of use ?
>> 
>> If those questions are for me ;-):
>> Afair (have to do iOS most of the time now), "Undo" is the most prominent example. You don't link those menu entries to a concrete object, but rather say "bind this to a selector whose name is…", and then the system can determine the actual target (there may be many controls which support undo).
>> Additionally, before this can happen, the system has to determine wether an entry is enabled at all — you can't do this when you have only a simple closure.
>> 
>> Best regards,
>> Tino


More information about the swift-evolution mailing list