0
Section
      {
          Picker("Tip percentage", selection: $smth)
          {
               ForEach(tipPercentages, id: .self)
                 {
                      Text($0, format: .percent)
                 }
         }
         .pickerStyle(.segmented)
    }

So I have this line of code and I just have a tiny question, before I use the pickerStyle modifier on the Picker View the text always shows up and gets displayed. But then when I use this .segmented modifier suddenly the "Tip percentage" text just disappears..? Why exactly is this happening? If this is happening what is even the point of having it be there??

1 Answers1

0

The label is not shown on segmented pickers. However, the label is read by screen readers. It’s a good practice to put a label on them for accessibility.

If you really need to show that text, use a Text view. (In a HStack or something)

Jongwoo Lee
  • 774
  • 7
  • 20