I want to display a picker to the user that has pre-defined numbers in a list, on watchOs 7. I am achieving this as follows:
I have a WKInterfacePicker outlet:
@IBOutlet var myPicker: WKInterfacePicker!
In my awake method, I populate the picker:
override func awake(withContext context: Any?) {
var options : [WKPickerItem] = [];
for currNumber in stride(from: 0, to: 502.5, by: 2.5) {
let item = WKPickerItem();
item.title = String(currNumber);
options.append(item)
}
myPicker.setItems(options)
myPicker.setRelativeWidth(0.6, withAdjustment: 0)
myPicker.setRelativeHeight(1, withAdjustment: 0)
}
In the user interface, I can then see the values and scroll through them.
However, when scrolling through the list, I get this non-fatal error:
Extension[1043:1380997] [detents] could not play detent NO, 3, Error Domain=NSOSStatusErrorDomain Code=-536870187 "(null)", (
{
Gain = "0.02700000070035458";
OutputType = 0;
SlotIndex = 2;
},
{
Gain = "0.4000000059604645";
OutputType = 1;
SlotIndex = 3;
}
)
My question relates to this Stack post: List inside ScrollView is not displayed on WatchOs , where the recommendation is to pay attention to the constraints. I've tried to increase the width of the picker, to no resolution. Is there an alternate solution to consider in fixing this issue?