Skip to content

Instantly share code, notes, and snippets.

@akio0911
Created August 7, 2020 06:54
Show Gist options
  • Save akio0911/9676b93e7e274a588afa4a1ebdf1115d to your computer and use it in GitHub Desktop.
Save akio0911/9676b93e7e274a588afa4a1ebdf1115d to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let tapGestureRecognizer = UITapGestureRecognizer(
target: self,
action: #selector(ViewController.didTapView)
)
view.addGestureRecognizer(tapGestureRecognizer)
}
@objc func didTapView() {
view.endEditing(true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment