Skip to content

Array of Dictionaries

AP Orlebeke edited this page Apr 10, 2020 · 2 revisions

Because of how ProfileCreator displays arrays and dictionaries in the interface, preferences that involve an array of dictionaries requires a specific format in order to display properly.

There are several important components to making this display properly:

  1. The base preference has a pfm_type of array
  2. The base preference has a single subkey with a pfm_type of dictionary with no pfm_name key
  3. Critically, the dictionary subkey has a pfm_hidden key with a value of container
  4. All dictionary preferences are subkeys of the single dictionary subkey

An example of this format is below.

<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>
			<!-- vv IMPORTANT COMPONENT vv -->
			<key>pfm_hidden</key>
			<string>container</string>
			<!-- ^^ IMPORTANT COMPONENT ^^ -->
			<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>

When formatted correctly, this is the result:

GUI

Array of Dictionaries GUI

XML

Array of Dictionaries XML