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

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay