Learn Courses My Dashboard

Simple input using decimalPad

I’m just learning, so please forgive any simple mistakes, but I want to set up a view that has the decimal pad displayed at all times, so that the user can enter a decimal number and hit a “Submit” button. I’ve tried using TextField() with the .keyboardType(.decimalPad) modifier, but the view just shows the textfield without the keypad. I googled and somehow I can’t find an example! Can anyone point me to an example or tutorial or some documentation that shows me how to do this?

Many thanks!


Hi Drew,

When you run the App on a simulator you will need to place your cursor in the TextField and then use the Simulator menu to activate the keyboard.

From the Simulator Menu, Tap I/O then tap Keyboard then tap Toggle Software Keyboard.