A solution could be put a UIButton on top of UITextField to block interactions. So when user tap the button, all we have to do is make UITextField become first responder
class DisableTextField: UIViewController {
@IBOutlet weak var textfield: UITextField!
@IBOutlet weak var button: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func onTap(_ sender: Any) {
textfield.becomeFirstResponder()
}
}