[swift-users] Swift 3 likes to tease me
jgroff at apple.com
Fri Sep 23 13:35:29 CDT 2016
> On Sep 22, 2016, at 9:51 PM, Gerriet M. Denkmann via swift-users <swift-users at swift.org> 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 advice I change it to:
> if a.responds(to: #selector(“viewControllers"))
> and now get an error instead: Argument of ‘#selector' does not refer to an '@objc' method, property, or initializer
Others have answered your question, but this looks to me like an opportunity for us to improve the error message. Attempting to use #selector() with a string literal like this seems like a natural thing to try, and we could offer better diagnostics for this case. If you have a moment, would you be able to file a bug to improve the diagnostics in this case?
> Why do I get punished for following Xcode’s advice?
> swift-users mailing list
> swift-users at swift.org
More information about the swift-users