I have a Picker that is set to navigationLink. When you click the picker you are correctly taken through to the picker page. It then renders the list of options and a tick for the selected options. But all the options are blank text. When you click on one it changes correctly and the label on the main page updates correctly. I am only seeing this issue on iPad and not iPhone.
I have a similar picker below but set the style to 'menu' and that shoes labels just fine, but its not what i want for this UI (the labels are long).
Has anyone seen this issue before and know how to fix it?
I have the following code which renders a picker, specifically in the .navigationLink
style. Its rendered in a popover with a navigation stack.
Picker(
String(
localized: "Single Tap",
comment: "The label that is shown next to the single tap action"
),
selection: $tapAction
) {
ForEach(Action.tapCases) { currentTapAction in
Text(currentTapAction.display)
}
}.pickerStyle(.navigationLink)
Here is the code for the Action enum that is being used.
enum Action: String, CaseIterable, Identifiable, Codable {
case next, back, none, fast, select, delete, clear, startScanning
var id: Self { self }
static public var tapCases: [Action] = [.next, .back, .none, .select, .delete, .clear, .startScanning]
static public var holdCases: [Action] = [.next, .back, .none, .fast, .select, .delete, .clear, .startScanning]
var display: String {
switch self {
case .none: return String(
localized: "None",
comment: "Label for action that happens on a keypress"
)
case .next: return String(
localized: "Go to the next item",
comment: "Label for action that happens on a keypress"
)
case .back: return String(
localized: "Go to the previous item",
comment: "Label for action that happens on a keypress"
)
case .fast: return String(
localized: "Quickly scan through the items",
comment: "Label for action that happens on a keypress"
)
case .select: return String(
localized: "Select the currently selected item",
comment: "Label for action that happens on a keypress"
)
case .delete: return String(
localized: "Delete the last inputted letter",
comment: "Label for action that happens on a keypress"
)
case .clear: return String(
localized: "Clear all the inputted text",
comment: "Label for action that happens on a keypress"
)
case .startScanning: return String(
localized: "Start scanning from the current item, scanning must be enabled",
comment: "Label for action that happens on a keypress"
)
}
}
}