KeyboardType for negative numbers?

Anybody know the best way to let users enter negative numbers into a TextFIeld? It appears as though none of the keyboard types allow the entry of negative decimal numbers. Is this true or am I missing something simple.

I'm using SwiftUI.

Answered by Claude31 in 722973022

You have to use .numbersAndPunctuationor the default keyboard. Not extremely convenient, would be better to have just digits, separator and +/-.

See here: https://betterprogramming.pub/12-shades-of-keyboard-types-in-ios-a413cf93bf4f

Accepted Answer

You have to use .numbersAndPunctuationor the default keyboard. Not extremely convenient, would be better to have just digits, separator and +/-.

See here: https://betterprogramming.pub/12-shades-of-keyboard-types-in-ios-a413cf93bf4f

Thanks, that's certainly better than using the default keyboard.

KeyboardType for negative numbers?
 
 
Q