-
-
Save sturdysturge/1ff5cbd27f863a8d4c075ffa5cce33b5 to your computer and use it in GitHub Desktop.
UITextField Extensions First Responder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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