In the session "What’s new in SwiftUI", at 02:38 Steven shows various Liquid Glass components, among them, a very pretty interactive glassy Picker.
At first I thought this was built into the system and tried everything possible, until to rewatch the presentation and notice this:
"On macOS, like on iOS, you can mark Liquid Glass custom elements as "interactive" so they respond more fluidly to user's clicks. And this is optimized to work great with the mouse pointer, so it feels right at home on the Mac."
Does anyone have pointers to where one can find a Picker that implements all these system behaviors that folks have come to expect?
I have my own version, which is deeply lacking, and so is every other implementation out there that I saw, and I thought sprinkling some "interactive" as instructed would help, but it barely made a dent.
Hi! To get the style shown in the video, you can add these modifiers to your Picker:
Picker(...)
.buttonBorderShape(.capsule)
.pickerStyle(.tabs)
You also get this appearance automatically if you use a TabView at the root of your scene, or in a sidebar or inspector.
An important thing to note for accessibility, though, is that this style should only be used for tabs and not value selection (like selecting text alignment in an inspector, for example). VoiceOver reads this version as "tabs" instead of a generic "radio button".