I was looking for ability to select multiple items. During my exploration I have
found that there is no possiblity to make it select more than one item. This fact
was also confirmed by Paul Hudson on his #Slack
channel. Being in this situation I searched for any examples of such code.
This led me to Stackoverflow where I have found partially working solution.
So after many refinements and tweaks I managed to simulate Picker and be able to
select multiple items.
Below is complete working code with example Language Enum as source of choices.
When you select “Choose languages” selection sheet is presented.
When you select 0 or more item and hit “OK” button modal is dismissed and counter on
“Choose languages” row is updated to number of items choosen.
This code is very rough, and there are many places where it could be written better,
but this is its first implementation which works as I wanted.
If you have any comments about below elements feel free to comment on Twitter.
This is main view which will present Picker:
ContentView
Source of Picker items - in this example Language enum
Language Enum
Combine helper which passes updated values between views and updates picker with previously choosen values
Combine Helper class to expose selected language array