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.
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!
Top comments (0)