Repository navigation
feat(picker): implement Picker and built-in styles - #1280
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2179633644
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let view = UIKitPickerView(frame: .zero) | ||
| view.delegate = context.coordinator | ||
| return view |
There was a problem hiding this comment.
Assign the wheel picker's data source
On iOS and visionOS, UIKitWheelPicker assigns only delegate, leaving the native UIPickerView.dataSource unset. Although the coordinator implements UIPickerViewDataSource, the picker cannot obtain its component and row counts without that assignment, so .pickerStyle(.wheel) renders without selectable options. Assign context.coordinator to view.dataSource as well.
Useful? React with 👍 / 👎.
| init(selection: [Binding<SelectionValue>]) { | ||
| _selection = Binding(flattening: selection) | ||
| multiSelection = selection |
There was a problem hiding this comment.
Handle empty source collections before flattening selection
When a picker created with sources: receives an empty collection—for example, an inspector after the user deselects all objects—this unconditional flattening crashes while constructing the configuration. Binding.init(flattening:) immediately calls FlattenedCollectionLocation.get(), whose primaryLocation force-unwraps base.first. Handle the empty-selection case before constructing a binding that requires a primary location so these pickers can remain mounted when their source collection becomes empty.
Useful? React with 👍 / 👎.
🛠️ Tuist Run Report 🛠️Tests 🧪
Builds 🔨
Reported by Tuist, faster builds and reliable tests for Xcode, Gradle, Bazel, and more. |
|
/uitest update only-testing=OpenSwiftUIUITests/PickerUITests |
2179633 to
f1a6340
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1a634042e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if let text = item.base.text { | ||
| if control.label(forSegment: index) != text.string { | ||
| control.setLabel(text.string, forSegment: index) | ||
| } | ||
| } else if let image = item.base.image { |
There was a problem hiding this comment.
Clear stale segment labels and images during updates
On macOS, when a segmented picker's option changes from text to an image (or vice versa), the existing native segment retains its previous content. NSSegmentedControl stores its label and image separately, but this update loop only sets the newly applicable property, so an image-only option can still display the old title and a text-only option can retain the old icon. Clear the image in the text branch and clear the label in the image branch, including clearing both when neither is present.
Useful? React with 👍 / 👎.
Closes #1225
Summary
Picker,PickerContent,PickerBuilder,PickerStyle,View.pickerStyle(_:),View.selectionDisabled(_:),PaletteSelectionEffect, and variadicTagaccessors for single- and multi-binding option selection.HorizontalAlignment.formDetailLeading), menu title and dismissal modifiers, radio group accessibility configuration, and stack/list style context updates.Pickerexample previews, hosted UI snapshot tests, andTagunit tests.