I\'m new to IOS programming, I\'m displaying a view when a button is clicked, using the following code inside the button method.
@IBAction func moreButton(_
You can use this method in swift 4.
add the tag number to the uiview you want to add action
override func touchesEnded(_ touches: Set, with event: UIEvent?) { if touches.first?.view?.tag == 10{ dismiss(animated: true, completion: nil) super.touchesEnded(touches , with: event) } }