Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//
// UIViewController+Ext.swift
//
//
// Created by Maysam Shahsavari on 2020-08-06.
//
import Foundation
import UIKit
extension UIViewController {
func shouldResignKeyboardOnTap() {
let tap = UITapGestureRecognizer(target: self, action: #selector(endEditingFields))
self.view.addGestureRecognizer(tap)
}
@objc func endEditingFields (){
view.endEditing(true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment