I am using a TextField to let the user add a price for something. To prevent the user adding other values as a number, I change the keyboard type to .decimalPad
.decimalPad