> On Sep 22, 2016, at 9:51 PM, Gerriet M. Denkmann via swift-users
> wrote:
>
> This line (Swift 3):
> if a.responds(to: Selector(“viewControllers") )
> creates this warning: Use '#selector' instead of explicitly constructing a
> 'Selector'
>
> Ok. Following this
Once you've determined this object responds to the selector, how do you
intend to use it?
It's probably best to define your own protocol that has the requirement,
and then you can access it via the protocol. In fact, at that point you
might even be able to use "as?" rather than
> On 23 Sep 2016, at 12:09, Marco S Hyman wrote:
>
> On Sep 22, 2016, at 9:51 PM, Gerriet M. Denkmann via swift-users
> wrote:
>>
>> This line (Swift 3):
>> if a.responds(to: Selector(“viewControllers") )
>> creates this warning: Use '#selector'
#selector is not used with a string, but with an actual reference to a
method. If, for instance, you have a protocol MyVC which declares `var
viewControllers: ...` then you can use something like
#selector(MyVC.viewControllers).
On Thu, Sep 22, 2016 at 9:51 PM, Gerriet M. Denkmann via swift-users
Xcode will be happy if you add “@objc” in front of your “func” declaration.
> On 23 Sep 2016, at 2:51 PM, Gerriet M. Denkmann via swift-users
> wrote:
>
> This line (Swift 3):
> if a.responds(to: Selector(“viewControllers") )
> creates this warning: Use
This line (Swift 3):
if a.responds(to: Selector(“viewControllers") )
creates this warning: Use '#selector' instead of explicitly constructing a
'Selector'
Ok. Following this advice I change it to:
if a.responds(to: #selector(“viewControllers"))
and now get an error instead: