KeyboardTypes in SwiftUI

I am a Software Engineer working on open source and enterprise mobile SDKs for iOS and MacOS developers written in Swift. From 🇩🇪 and happily living in 🇺🇸
Search for a command to run...

I am a Software Engineer working on open source and enterprise mobile SDKs for iOS and MacOS developers written in Swift. From 🇩🇪 and happily living in 🇺🇸
Indeed, keyboards come in all sorts of forms, but most of them have one problem in common - if you use them carelessly, the keyboard will eventually fail. To prevent this from happening, I recommend using a macbook pro retina keyboard cover like this. With them, your keyboard will always stay clean and it will be impossible to scratch.
WWDC26 kicked off on June 8, 2026. The information in this article reflects the information published by Apple on that date. There are 14 new frameworks. Name Description AccessoryAccess Manage

WWDC25 kicked off on June 9, 2025. The information in this article reflects the information published by Apple on that date. New Frameworks NameDescription AlarmKitSchedule prominent alarms and countdowns to help people manage their time. AVR...

WWDC25 is almost here, and I couldn’t be more excited! Whether you're attending the official events, community meetups, or just soaking in the energy around Cupertino, there’s no better time to connect, share ideas, and celebrate everything we love a...

In this blog post, I’ll share an observation and advice regarding the caching behavior of network responses by Apple’s APIs. If you are unfamiliar with caching of network responses then I recommend Apple’s article Accessing cached data that introduce...
WWDC24 kicked off on June 10, 2024. The information in this article reflects the information published by Apple on that date. New Frameworks NameDescription AccessorySetupKitUse AccessorySetupKit to discover accessories with Bluetooth or Wi-Fi...

This blog post will show you the different iOS keyboard types (screenshots) and how to apply them to SwiftUI views.
I will also share a project that can help you build custom keyboard extensions with SwiftUI.
Apple provides 12 types of the iOS keyboard with the enum UIKeyboardType in the UIKit framework.
All of these specialized keyboard types are available in SwiftUI and can be applied to through an existing extension on View. Example:
TextField("someone@example.com", text: $emailAddress)
.keyboardType(.emailAddress)
This extension is available for iOS and tvOS since 13.0.
extension View {
@available(iOS 13.0, tvOS 13.0, *)
@available(macOS, unavailable)
@available(watchOS, unavailable)
public func keyboardType(_ type: UIKeyboardType) -> some View
}
Specifies the default keyboard for the current input method.
.keyboardType(.default)

Specifies a keyboard that displays standard ASCII characters.
.keyboardType(.asciiCapable)

Specifies the numbers and punctuation keyboard.
.keyboardType(.numbersAndPunctuation)

This keyboard type prominently features the period (“.”) and slash (“/”) characters and the “.com” string.
.keyboardType(.URL)

This keyboard type prominently features the numbers 0 through 9. This keyboard type does not support auto-capitalization.
.keyboardType(.numberPad)

This keyboard type prominently features the numbers 0 through 9 and the “*” and “#” characters. This keyboard type does not support auto-capitalization.
.keyboardType(.alphabet)

Specifies a keypad for entering a person’s name or phone number. This keyboard type does not support auto-capitalization.
.keyboardType(.namePhonePad)

This keyboard type prominently features the at (“@”), period (“.”) and space characters.
.keyboardType(.emailAddress)

Specifies a keyboard with numbers and a decimal point.
.keyboardType(.decimalPad)

Specifies a keyboard for Twitter text entry, with easy access to the at (“@”) and hash (“#”) characters.
.keyboardType(.twitter)

This keyboard type prominently features the space and period (“.”) characters.
.keyboardType(.webSearch)

Specifies a number pad that outputs only ASCII digits.
.keyboardType(.asciiCapableNumberPad)

Use UIKeyboardType.asciiCapable instead.
.keyboardType(.alphabet)

If you are interested in building your custom keyboard extension, you should look if `KeyboardKit can help you. This project is brought to you by Daniel Saidi.
KeyboardKit helps you build custom keyboard extensions with Swift and SwiftUI. It extends the native keyboard APIs and provides you with a lot more functionality than is otherwise available.
The end result can look something like this...or entirely different:
