Learn Courses My Dashboard

Wheel-Picker, SegmentedPicker: Purpose of the label-argument?

Which purpose serves the label-argument of the Wheel-Picker? Or the SegmentedPicker?

For example here:

Picker("Your order", selection: $orderIndex) {
    ForEach(0..<meals.count, id: \.self) { index in
        Text(meals[index]).tag(index)
    }
}.pickerStyle(WheelPickerStyle())

“Your order” doesn’t appear on the UI. One has to use an extra Text-element.
The argument makes no sense to me.

The label will show up in certain circumstances. When the Picker is in a Form, for instance.

1 Like