是否可以在文本字段中显示之前修改自动填充字符串?

Is it possible to modify the AutoFill string before showing in textfield?

我必须更改来自自动填充的 phone 数字字符串,然后写入文本字段。我使用 this method 来检测自动填充。但是我无法访问该方法中的字符串。可能吗?

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool

其中 replacementString 是您的答案