-
Notifications
You must be signed in to change notification settings - Fork 147
Preference Templates
Below are a number of examples of common and more complex preference formats which can be used as templates and best practices when creating new manifests or updating existing ones.
The default boolean format. ☑️ = true ; 🔲 = false
<dict>
<key>pfm_description</key>
<string>Boolean pref description</string>
<key>pfm_name</key>
<string>BooleanPrefName</string>
<key>pfm_type</key>
<string>boolean</string>
</dict>
Displays text options, rather than the actual true | false
values. Requires the use of the pfm_range_list_titles
array. The first option listed in the array is false
, the second is true
.
<dict>
<key>pfm_description</key>
<string>Boolean pref description</string>
<key>pfm_name</key>
<string>BooleanPrefName</string>
<key>pfm_range_list_titles</key>
<array>
<string>Boolean False Option Text</string>
<string>Boolean True Option Text</string>
</array>
<key>pfm_type</key>
<string>boolean</string>
</dict>
For specific scenarios where the preference wording requires the value supplied to be inverted. As a result, if true
is selected ProfileCreator will instead list false
, and vice versa.
<dict>
<key>pfm_description</key>
<string>Boolean pref description</string>
<key>pfm_name</key>
<string>BooleanPrefName</string>
<key>pfm_type</key>
<string>boolean</string>
<key>pfm_value_inverted</key>
<true/>
</dict>
The default string format.
<dict>
<key>pfm_description</key>
<string>String pref description</string>
<key>pfm_name</key>
<string>StringPrefName</string>
<key>pfm_type</key>
<string>string</string>
</dict>
Unlike pfm_default
which inputs the default value without user interaction, pfm_value_placeholder
shows a suggested or example value that is not supplied as the preference value.
<dict>
<key>pfm_description</key>
<string>String pref description</string>
<key>pfm_name</key>
<string>StringPrefName</string>
<key>pfm_type</key>
<string>string</string>
<key>pfm_value_placeholder</key>
<string>Suggested or example placeholder value</string>
</dict>
When the supplied string requires specific formatting. Regular expression that marks text in red when the entered value does not match. Helpful when a placeholder is also included.
<dict>
<key>pfm_description</key>
<string>String pref description</string>
<key>pfm_format</key>
<string>^https?://.*$</string>
<key>pfm_name</key>
<string>StringPrefName</string>
<key>pfm_type</key>
<string>string</string>
<key>pfm_value_placeholder</key>
<string>https://example.com</string>
</dict>
Default when pfm_range_list
is used with string preferences.
<dict>
<key>pfm_description</key>
<string>String pref description</string>
<key>pfm_name</key>
<string>StringPrefName</string>
<key>pfm_range_list</key>
<array>
<string>StringOption1</string>
<string>StringOption2</string>
<string>StringOption3</string>
</array>
<key>pfm_type</key>
<string>string</string>
</dict>
Rather than display the actual string options themselves, display more user-friendly text corresponding to each value. Makes it clearer what each option means.
<dict>
<key>pfm_description</key>
<string>String pref description</string>
<key>pfm_name</key>
<string>StringPrefName</string>
<key>pfm_range_list</key>
<array>
<string>StringOption1</string>
<string>StringOption2</string>
<string>StringOption3</string>
</array>
<key>pfm_range_list_titles</key>
<array>
<string>String Option 1</string>
<string>String Option 2</string>
<string>String Option 3</string>
</array>
<key>pfm_type</key>
<string>string</string>
</dict>
Alternative to the default dropdown menu when pfm_range_list
is used for strings.
<dict>
<key>pfm_description</key>
<string>String pref description</string>
<key>pfm_name</key>
<string>StringPrefName</string>
<key>pfm_range_list</key>
<array>
<string>StringOption1</string>
<string>StringOption2</string>
<string>StringOption3</string>
</array>
<key>pfm_title</key>
<string>String Pref Name</string>
<key>pfm_type</key>
<string>string</string>
<key>pfm_type_input</key>
<string>boolean</string>
</dict>
The default integer format.
<dict>
<key>pfm_description</key>
<string>Integer pref description</string>
<key>pfm_name</key>
<string>IntegerPrefName</string>
<key>pfm_type</key>
<string>integer</string>
</dict>
When there is a concrete minimum and/or maximum integer value. Permits any number in the range, including the number supplied (effectively ≥ and ≤).
<dict>
<key>pfm_description</key>
<string>Integer pref description</string>
<key>pfm_name</key>
<string>IntegerPrefName</string>
<key>pfm_range_max</key>
<integer>100</integer>
<key>pfm_range_min</key>
<integer>1</integer>
<key>pfm_type</key>
<string>integer</string>
</dict>
Unlike pfm_default
which inputs the default value without user interaction, pfm_value_placeholder
shows a suggested or example value that is not supplied as the preference value.
<dict>
<key>pfm_description</key>
<string>Integer pref description</string>
<key>pfm_name</key>
<string>IntegerPrefName</string>
<key>pfm_type</key>
<string>integer</string>
<key>pfm_value_placeholder</key>
<integer>5</integer>
</dict>
For when only certain integer values are permissible.
<dict>
<key>pfm_description</key>
<string>Integer pref description</string>
<key>pfm_name</key>
<string>IntegerPrefName</string>
<key>pfm_range_list</key>
<array>
<integer>0</integer>
<integer>1</integer>
<integer>2</integer>
</array>
<key>pfm_type</key>
<string>integer</string>
</dict>
Rather than display the integer options themselves, display text corresponding to each value. Makes it clearer what each option means.
<dict>
<key>pfm_description</key>
<string>Integer pref description</string>
<key>pfm_name</key>
<string>IntegerPrefName</string>
<key>pfm_range_list</key>
<array>
<integer>0</integer>
<integer>1</integer>
<integer>2</integer>
</array>
<key>pfm_range_list_titles</key>
<array>
<string>Option 1</string>
<string>Option 2</string>
<string>Option 3</string>
</array>
<key>pfm_type</key>
<string>integer</string>
</dict>
Preferences for real / floating point values can have a pfm_type
of either real
OR float
.
<dict>
<key>pfm_description</key>
<string>Real pref description</string>
<key>pfm_name</key>
<string>RealPrefName</string>
<key>pfm_type</key>
<string>real</string>
</dict>
Limit the decimal places used for the preference value. For example, entering 0.1
translates to a value of 0.10000000000000001
. Limiting to 2 decimal places instead becomes 0.10
.
<dict>
<key>pfm_description</key>
<string>Real pref description</string>
<key>pfm_name</key>
<string>RealPrefName</string>
<key>pfm_type</key>
<string>real</string>
<key>pfm_value_decimal_places</key>
<integer>2</integer>
</dict>
<dict>
<key>pfm_description</key>
<string>Real pref description</string>
<key>pfm_name</key>
<string>RealPrefName</string>
<key>pfm_range_max</key>
<real>1</real>
<key>pfm_range_min</key>
<real>0</real>
<key>pfm_type</key>
<string>real</string>
</dict>
With this template, pfm_title
is used in place of pfm_value_placeholder
for the strings.
<dict>
<key>pfm_description</key>
<string>Array pref description</string>
<key>pfm_name</key>
<string>ArrayPrefName</string>
<key>pfm_subkeys</key>
<array>
<dict>
<key>pfm_title</key>
<string>String Pref Name</string>
<key>pfm_type</key>
<string>string</string>
</dict>
</array>
<key>pfm_type</key>
<string>array</string>
</dict>
<dict>
<key>pfm_description</key>
<string>Array pref description</string>
<key>pfm_name</key>
<string>ArrayPrefName</string>
<key>pfm_subkeys</key>
<array>
<dict>
<key>pfm_range_list</key>
<array>
<string>String Option 1</string>
<string>String Option 2</string>
<string>String Option 3</string>
</array>
<key>pfm_title</key>
<string>String Pref Name</string>
<key>pfm_type</key>
<string>string</string>
</dict>
</array>
<key>pfm_type</key>
<string>array</string>
</dict>
When a given string value can only be used once. pfm_value_unique
prevents multiple use.
<dict>
<key>pfm_description</key>
<string>Array pref description</string>
<key>pfm_name</key>
<string>ArrayPrefName</string>
<key>pfm_subkeys</key>
<array>
<dict>
<key>pfm_range_list</key>
<array>
<string>String Option 1</string>
<string>String Option 2</string>
<string>String Option 3</string>
</array>
<key>pfm_title</key>
<string>String Pref Name</string>
<key>pfm_type</key>
<string>string</string>
<key>pfm_value_unique</key>
<true/>
</dict>
</array>
<key>pfm_type</key>
<string>array</string>
</dict>
More detailed info can be found on this wiki page.
<dict>
<key>pfm_description</key>
<string>ARRAY OF DICTIONARIES DESCRIPTION</string>
<key>pfm_name</key>
<string>ARRAY_OF_DICTIONARIES_KEY</string>
<key>pfm_subkeys</key>
<array>
<dict>
<key>pfm_hidden</key>
<string>container</string>
<key>pfm_subkeys</key>
<array>
<dict>
<key>pfm_description</key>
<string>PREF 1 KEY DESCRIPTION</string>
<key>pfm_name</key>
<string>PREF_1_KEY</string>
<key>pfm_title</key>
<string>PREF 1 FRIENDLY NAME</string>
<key>pfm_type</key>
<string>string</string>
</dict>
<dict>
<key>pfm_description</key>
<string>PREF 2 KEY DESCRIPTION</string>
<key>pfm_name</key>
<string>PREF_2_KEY</string>
<key>pfm_title</key>
<string>PREF 2 FRIENDLY NAME</string>
<key>pfm_type</key>
<string>string</string>
</dict>
</array>
<key>pfm_type</key>
<string>dictionary</string>
</dict>
</array>
<key>pfm_title</key>
<string>NAME OF ARRAY OF DICTIONARIES</string>
<key>pfm_type</key>
<string>array</string>
</dict>