UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Is it possible to change language of keyboard layout in SwiftUI?

Forums > SwiftUI

I can't find anything on changing keyboard language layout in SwiftUI when entering text in a TextField, as I've been able to do for regular Swift.

3      

Not sure what you mean but if .keyboardType() modifier and you get a number of option see UIKeyboardType

TextField("", text: $text)
    .keyboardType(.emailAddress)

3      

@NigelGee No, I don't mean that. I want to change keyboard language layout based on a BCP code I get from querying the system for the language locale the device is set to. I have achieved this in UIKit, but don't see an officially supported equivalent in SwiftUI.

3      

But shouldn't the app always use the keyboard language the user has set it to?

3      

@Hatsushira It's a language learning app, the user has the option of typing in foreign words using a foreignor native keyboard. A toggle switch allows the keyboard layout to switch between a native or foreign keyboard layout!

3      

Ah, okay, now it makes sense for me. My guess is that you have to rely on the UIKit API because I haven't found anything on SwiftUI.

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.