Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UITextField Extensions First Responder
import UIKit
extension UITextField {
convenience init(coordinator: CustomTextField.Coordinator) {
self.init(frame: .zero)
self.delegate = coordinator
}
func setFirstResponder(_ isResponder: Bool) {
DispatchQueue.main.async {
if isResponder {
self.becomeFirstResponder()
} else {
self.resignFirstResponder()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment