How to Decode Human-Readable JSON Strings to Integer-Based Swift.OptionSet

I want to decode JSON that’s human readable but still represents a Swift.OptionSet. Traditionally, OptionSets are implemented with an integer-based rawValue, because that gives you the set algebra for free. Here’s my type: Here, all represents the whole text of a document, for example, and selected stands for the current selected text, if any.

Continue reading …