IOS - How to hide a view by touching anywhere outside of it : <p>I'm new to IOS programming, I'm displaying a view when a button is clicked, using the following code inside the button method.</p>

<pre><code> @IBAction func moreButton(_ sender: Any)
    {
        self.helpView.isHidden = false
    }
</code></pre>

<p>initially, the <code>self.helpView.isHidden</code> is set to true in <code>viewDidLoad</code> method to hide the view. Now, how can i dismiss this view by touching anywhere outside the view. From the research, i found that, it can be done by creating a transparent button that fits the whole viewController. So then by clicking on the button, we can make the view to dismiss. Can anyone give me the code in swift 3 to create such button.</p>

<p>Or, if there is any other better way to hide a view, it is welcomed.</p>

<p>I'm using Xcode 8.2, swift 3.0</p>

<p>Thanks in advance.</p>
