TextField("Amount", value: $billTotal, format: .currency(code: Locale.current.currency?.identifier ?? "USD"))
.keyboardType(.decimalPad)
Today, the modifier .keyboardType() is unavailable for watchOS. I guess that makes sense in a way as some models of Apple Watch do not even have an on-screen keyboard.
However, it might be nice to be able to use this specifier for things like the continuity keyboard. If the message pops up on your iPhone and you choose to type there, wouldn’t it be a nice idea for the keyboard to default to the decimal pad or email address keyboard in the correct instance?
Another problem you will encounter trying to build for the Apple Watch on Day 17 is that the picker on watchOS doesn’t have any styles.
Picker("Tip Percentage", selection: $tipPercentage) {
ForEach(tipPercentages, id: \.self) {
Text($0, format: .percent)
}
}
.pickerStyle(.segmented)
Therefore we cannot use the .segmented pickerStyle as suggested by Paul. Again, on the watch, the screen size would probably mean the touch targets, or the area that you are able to tap, would be too small for a segmented picker to be of real-world use.
My suggestion here is to just keep this Picker a standard picker, as per the number of people picker above it.
Leave a Reply