DEV Community

Cover image for Update to "My Custom Picker With Multi-Selection in SwiftUI" - Now With Images!
Kyra
Kyra

Posted on • Originally published at simplykyra.com

1

Update to "My Custom Picker With Multi-Selection in SwiftUI" - Now With Images!

I just wanted to start out by saying that this is an abridged version of my originally published post from August 31, 2022 that you can find on my website here.

It is also a continuation (part two) of my original post which is also an abridged from my originally published version from February 23, 2022 here.


After I posted my custom multipicker code someone reached out to me about having the selected items include images. I absolutely loved that idea and got to work switching the String array containing the items to a Struct array that could hold any possible thing you may want selectable. In this updated example I still store a String in the Struct, in this case holding the SF symbol name, but I could see this also including other types like Data or Image too.

Image description

Image description

If you’re interested in using this updated custom control in your code I saved it, in its entirety, to my public SimplyKyraBlog GitHub repository and, if you want a direct link, the file CustomMultiSelectionExampleWithImages.swift can be found here. The code is also shared as a Github Gist at the bottom of my post from August 31, 2022 that also includes the backstory, specific updates to the original code, and the fix to the previous issue I mentioned.

Hope this helps your code and you're having a great day!

Heroku

Tired of jumping between terminals, dashboards, and code?

Check out this demo showcasing how tools like Cursor can connect to Heroku through the MCP, letting you trigger actions like deployments, scaling, or provisioning—all without leaving your editor.

Learn More

Top comments (0)

Warp.dev image

Warp is the highest-rated coding agent—proven by benchmarks.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

Announcing the First DEV Education Track: "Build Apps with Google AI Studio"

The moment is here! We recently announced DEV Education Tracks, our new initiative to bring you structured learning paths directly from industry experts.

Dive in and Learn

DEV is bringing Education Tracks to the community. Dismiss if you're not interested. ❤️