title: Adding tap Gesture that calls a function in another class
body: <p>I added a <code>UITapGestureRecognizer</code> to an element. I want that function called after the tap gesture was recognized is in another class.</p>
  <p>This is my code :</p>
  <pre><code>let selectMoment = SelectMomentClass(countUserMoment: 1, cardView: self.cardView)
  selectMoment.draw()
  let gesture = UITapGestureRecognizer(target: self, action: #selector(selectMoment.selectMomentAction))
  cardView.addGestureRecognizer(gesture)
  </code></pre>
  <p>and my <code>SelectMomentClass</code> contains my function:</p>
  <pre><code>@objc func selectMomentAction(sender : UITapGestureRecognizer) {
      print(&quot;card selectMoment is Tapped&quot;)
  }
  </code></pre>
  <p>But when I run the code I have this error:</p>
  <blockquote>
  <p>unrecognized selector sent to instance</p>
  </blockquote>
  <p>Where does my code go wrong? This is the target parameter that I need to change. Can I called a function in another class?</p>
  <hr />
  <p>I found a similar <a href="https://stackoverflow.com/questions/16814895/">question</a> in Objective-C but it does not help me.</p>