如何正确地将短信中的代码插入文本字段?

How to insert code from sms into textfield correctly?

我使用一次性代码将代码从短信插入文本字段,它可以工作,但现在,在单击键盘顶部的代码后我无法插入它。 我希望,你能帮助我

Thats how does it look.

TextField("Введите код", text: $code.value).textContentType(.oneTimeCode)

我已经用过了,但是没用

View 上有一个修饰符,可让您设置内容的类型,因此系统可以向用户建议输入:

func textContentType(_ textContentType: UITextContentType?) -> some View

你需要传入oneTimeCode

TextField("Enter code", text: $code)
    .textContentType(.oneTimeCode)