How to set Keyboard type of TextField in SwiftUI?

后端 未结 7 1391
灰色年华
灰色年华 2021-02-03 19:46

I can\'t seem to find any information or figure out how to set the keyboard type on a TextField for SwiftUI. It would also be nice to be able to enable the secure text property,

7条回答
  •  不思量自难忘°
    2021-02-03 20:31

    We no longer need to use hacks. Beta 5 has brought a new modifier to set the keyboard type. For example, to use a number pad:

    .keyboardType(.numberPad)
    

    There's also autocapitalization() and an EnvironmentValue disableAutocorrection.

提交回复
热议问题