Skip to content

Preference Templates

AP Orlebeke edited this page Apr 15, 2020 · 24 revisions

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.

Index

Boolean

Boolean Checkbox

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>

Boolean Checkbox

Back to top

Boolean Radio Button

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>

Boolean Radio

Back to top

Boolean Inverted

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>

Boolean Inverted 1

Boolean Inverted 2

Back to top

Strings

String Textbox

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>

String Textbox

Back to top

String Textbox with Placeholder

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>

String Textbox Placeholder

Back to top

String Textbox with Format

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>

String Format 1

String Format 2

String Format 3

Back to top

String with Dropdown List

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>

String Dropdown 1

String Dropdown 2

Back to top

String with User-Friendly Dropdown List

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>

String Friendly Dropdown 1

String Friendly Dropdown 2

Back to top

String Checkbox

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>

Back to top

Integers

Integer Textbox

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>

Integer Textbox

Back to top

Integer Textbox with Range

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>

Integer Textbox Range

Back to top

Integer with Placeholder

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>

Integer Textbox Placeholder

Back to top

Integer Dropdown List

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>

Integer Dropdown 1

Integer Dropdown 2

Back to top

Integer with User-Friendly Dropdown List

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>

Integer Dropdown Friendly

Back to top

Real / Floating Point

Preferences for real / floating point values can have a pfm_type of either real OR float.

Real Textbox

<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>

Real Textbox

Back to top

Real Textbox with Decimal Places

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>

Real Textbox Decimals 1

Real Textbox Decimals 2

Back to top

Real Textbox with Range

<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>

Real Textbox Range

Back to top

Real Slider

Arrays

Array of Strings Textbox

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>

Array of Strings Textbox

Back to top

Array of Strings Dropdown List

<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>

Array of Strings Dropdown

Back to top

Array of Strings Dropdown List Without Duplication

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>

Array of Strings Dropdown Unique 1

Array of Strings Dropdown Unique 2

Back to top

Array of Dictionaries

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>

Back to top

Dictionaries

Clone this wiki locally