I have been working on color theme support in my Code Notes For iOS application. Part of that requires that I change the on-screen keyboard theme to match the light / dark theme selection.
There is a complication, whilst you can set the keyboard theme different for a UITextField when it gets focus for editing, I want to do it globally across the application and without having a text field present at the time it is set.
To do this I set it on the UITextField class rather than any text field that might currently be on display.
So for the default light keyboard I use
UITextField.appearance().keyboardAppearance = .default
For the dark keyboard I use
UITextField.appearance().keyboardAppearance = .dark
There are several options, but these are the ones that meet my needs. Here is the complete list of built-in options.
.dark .default .light .alert