How to add gesture to UITableViewCell?
<p>I want to add a tap gesture to every cell in a <code>UITableView</code> that edits the content in it. The two ways to add a gesture are in code or through storyboard. I tried both and they failed.</p>

<p>Can I add a gesture to <em>every</em> cell in table with storyboard drag and drop? It seems to only add gesture to the first cell. Adding gesture in code, I wrote something like,</p>

<pre><code>addGestureRecognizer(UITapGestureRecognizer(target: self,action:#selector(MyTableViewCell.tapEdit(_:))))
</code></pre>

<p>or</p>

<pre><code>addGestureRecognizer(UITapGestureRecognizer(target: self, action:"tapEdit:"))
</code></pre>

<p>both work. But I'd like to let the <code>UITableViewController</code> handle this gesture because it does something with the datasource. How do I write my target and action?</p>

<p>EDIT: </p>

<pre><code>addGestureRecognizer(UITapGestureRecognizer(target: MasterTableViewController.self, action:#selector(MasterTableViewController.newTapEdit(_:)))
</code></pre>

<p>it induce an error said, unrecognized selector sent to class 0x106e674e0...</p>