Defining keywords for dynamic configuration values

For all string type values in the MyConfiguration.plist configuration file, you can specify special keywords in the value string to cause the app to find the value in string resources or in settings. This task demonstrates specifying the title and icon for a custom menu item in the app's sidebar menu.

Perform this task in the copy of the DeploymentKitApp in Xcode on your computer.
Note: You can customize most settings in MyConfiguration.plist by editing key and value pairs in the Property List view in XCode. Optionally, you can edit the XML directly in the Source Code view. To work in the XML view, right click the file name, and then click Open As > Source Code.

Procedure

  1. Add your custom string resource entry to the appropriate Localization.strings file.
    See The app strings for more information.
  2. Add your image file to the Resources folder in the DeploymentKitApp project.
    See Modifying the app images for more information.
  3. In the file MyConfiguration.plist, specify the string: and resource: keywords to indicate that those configuration values should be loaded from resources. See the example.
    Note: Likewise, you can specify the keyword setting:, as shown in the configuration example, and then specify the key name of an app setting value to use instead. Then the app looks up the setting value and substitutes it in place of the keyword when it evaluates the configuration value.

Example: defining a custom menu item

The following example demonstrates deining a custom menu item.

  1. In the app file Localizable.strings, we defined these string resources.
    "my_menuitem_icon1_filename" = "test_menuitem_icon1.png";
    "my_menuitem_icon1selected_filename" = "test_menuitem_icon1_active.png";
  2. In the file MyConfiguration.plist, in the Property List view, find and expand the key labelled CustomMenuItems.
  3. Add the following entries.
    Key Type Value
    CustomMenuItems Array (2 items)
    Item 0 Dictionary (4 items)
    icon String string: my_menuitem_icon1_filename
    iconSelected String string: my_menuitem_icon1selected_filename
    title String setting: my_test_menuitem1_title
    url String http://spotfire.tibco.com
    Note: In the Source Code view, this section appears as follows.
    <dict>
       <key>icon</key>
       <string>string: my_menuitem_icon1_filename</string>
       <key>iconSelected</key>
       <string>string: my_menuitem_icon1selected_filename</string>
       <key>title</key>
       <string>setting: my_test_menuitem1_title</string>
       <key>url</key>
       <string>http://spotfire.tibco.com</string>
    </dict>
    
  4. In the Xcode project navigator, find and open the file DeploymentKitApp/Settings/Settings.bundle/Root.plist.
  5. In the Property List view, find the setting Text Field - My Custom Menu Item Title.
    Key Type Value
    Item 19 (Text Field - My Custom Menu Item Title) Dictionary (4 items)
    Default Value String My Custom Menu Item 1
    Identifier String my_test_menuitem1_title
    Title String My Custom Menu Item Title
    Type String Text Field
    Note: In the Source Code view, this section appears as follows.
    <dict>
       <key>DefaultValue</key>
       <string>My Custom Menu Item 1</string>
       <key>Key</key>
       <string>my_test_menuitem1_title</string>
       <key>Title</key>
       <string>My Custom Menu Item Title</string>
       <key>Type</key>
       <string>PSTextFieldSpecifier</string>
    </dict>
Related reference