# Keyboard

## Overview

## Subjects

### Keyboard Types

* **.default** : Default type for current input method
* **.asciiCapable** : Displays a keyboard which can enter ASCII characters
* **.numbersAndPunctuation** : Displays Numbers and assorted punctuation
* **.URL** : A type optimized for URL entry (shows . / .com prominently)
* **.numberPad** : A number pad with locale-appropriate digits (0–9, ۰-۹, ०-९, etc.). Suitable for PIN entry
* **.phonePad** : A phone pad (1–9, \*, 0, #, with letters under the numbers)
* **.namePhonePad** : A type optimized for entering a person’s name or phone number
* **.emailAddress** : A type optimized for multiple email address entry (shows space @ . prominently)
* **.decimalPad** : A number pad with a decimal point
* **.twitter** : A type optimized for twitter text entry (easy access to @ #)
* **.webSearch** : A default keyboard type with URL-oriented addition (shows space . prominently)
* **.asciiCapableNumberPad** : A number pad (0–9) that will always be ASCII digits.
* **.alphabet** : Displays a keyboard which can enter alphabetic characters, use .asciiCapable instead.

#### Source

* [DevTechie / SwiftUI TextField: Keyboard Types](https://www.devtechie.com/swiftui-textfield-keyboard-types)

### Dismissing the Keyboard

#### Sample Codes

```swift
@FocusState private var xxxIsFocused: Bool

.keyboardType(.decimalPad)
.focused($xxxIsFocused) // trigers the state

.navigationTitle("Title")
.toolbar {
    ToolbarItemGroup(placement: .keyboard) {
        Spacer() // brought Done to the right side
        Button("Done") {
            xxxIsFocused = false
        }
    }
}
```

#### Sources

* [UseYourLoaf / SwiftUI Dismissing The Keyboard](https://useyourloaf.com/blog/swiftui-dismissing-the-keyboard/)

{% embed url="<https://youtu.be/9WVeOGX313Q>" %}
[Hacking with Swift / Hiding the keyboard](https://www.hackingwithswift.com/books/ios-swiftui/hiding-the-keyboard)
{% endembed %}

## Sample Codes

```swift
```

## Sources

### Videos

### Articles / Documents

*

## See also

*
