I'm attempting to parse an API that uses arrays of strings to represent an option's various settings. It seems natural to try and parse this as a type conforming to OptionSet. However, the disconnect between the rawValue and the strings in the array may be a bit too much.
I'm parsing something like this:
{
"notification_options": ["phone", "email"]
}
Any ideas here? I'm currently going down the path of creating a failable, string-based initializer for my OptionSet but I don't think it's going to be very elegant.
I'm attempting to parse an API that uses arrays of strings to represent an option's various settings. It seems natural to try and parse this as a type conforming to
OptionSet. However, the disconnect between therawValueand the strings in the array may be a bit too much.I'm parsing something like this:
Any ideas here? I'm currently going down the path of creating a failable, string-based initializer for my
OptionSetbut I don't think it's going to be very elegant.