
A variant dictionary type allows you to treate a dictionary differently based on its content. A variant dictionary type contains a list of one or more dictionary classes defined elsewhere in the structure definition. When a dictionary's class is determined to be a variant dictionary, PlistEdit Pro will search through the variants and try to determine which variant is most applicable to the dictionary. This search is based on the "Variant key" and "Variant value" that is given for each dictionary class. To determine which variant to use, PlistEdit Pro evaluates each variant in order:
As an example of how a variant dictionary might be used, imagine you have a list of dictionaries, and each dictionary has a key named "class" which specifies a class name for that dictionary. For each possible class, you could create a dictionary type that would define the keys and values that apply to that class. For each dictionary type, you would specify "class" as the variant key for that dictionary type, and then the class name as the variant value. Finally, you would create a variant dictionary type and add a variant for each dictionary type you had created. Then, when one of these dictionaries was assigned your variant dictionary as its type, its "class" value would determine which dictionary type was used for that particular dictionary.