One of the keyboard types defined in the UIKeyboard
enumeration.
Instance Method
インスタンスメソッド
keyboard
keyboardType(_:)
Sets the keyboard type for this view.
キーボード型をこのビューに対して設定します。
Availability 有効性
- iOS 13.0+
- iPadOS 13.0+
- Mac Catalyst 13.0+
- tvOS 13.0+
Technology
- Swift
UI
Declaration 宣言
func keyboardType(_ type: UIKeyboardType
) -> some View
Parameters パラメータ
type
Type
Discussion 議論
Use keyboard
to specify the keyboard type to use for text entry. A number of different keyboard types are available to meet specialized input needs, such as entering email addresses or phone numbers.
The example below presents a Text
to input an email address. Setting the text field’s keyboard type to .email
ensures the user can only enter correctly formatted email addresses.
TextField("someone@example.com", text: $emailAddress)
.keyboardType(.emailAddress)
There are several different kinds of specialized keyboard types available though the UIKeyboard
enumeration. To specify the default system keyboard type, use .default
.