title: How do I resolve "ambiguous use of" compile error with Swift #selector syntax?
body: <p>[<strong>NOTE</strong> This question was originally formulated under Swift 2.2. It has been revised for Swift 4, involving two important language changes: the first method parameter external is no longer automatically suppressed, and a selector must be explicitly exposed to Objective-C.]</p>
  
  <p>Let's say I have these two methods in my class:</p>
  
  <pre><code>@objc func test() {}
  @objc func test(_ sender:AnyObject?) {}
  </code></pre>
  
  <p>Now I want to use Swift 2.2's new <code>#selector</code> syntax to make a selector corresponding to the <em>first</em> of these methods, <code>func test()</code>. How do I do it? When I try this:</p>
  
  <pre><code>let selector = #selector(test) // error
  </code></pre>
  
  <p>... I get an error, "Ambiguous use of <code>test()</code>." But if I say this:</p>
  
  <pre><code>let selector = #selector(test(_:)) // ok, but...
  </code></pre>
  
  <p>... the error goes away, but I'm now referring to the <em>wrong method</em>, the one <em>with</em> a parameter. I want to refer to the one <em>without</em> any parameter. How do I do it?</p>
  
  <p>[Note: the example is not artificial. NSObject has both Objective-C <code>copy</code> and <code>copy:</code> instance methods, Swift <code>copy()</code> and <code>copy(sender:AnyObject?)</code>; so the problem can easily arise in real life.]</p>