Skip to main content

Property List (PLIST) Task Configuration (plist)

Modify Info.plist file

The plist task allows you to modify property list (plist) files, typically used in iOS projects, to add or modify values.

Task Properties

PropertyTypeDescription
task"plist", requiredSpecifies the task type, which should be set to "plist" for this task.
namestringAn optional name for the task. If provided, the task state will be saved as a variable. Visit Task and Action States page to learn more.
labelstringAn optional label or description for the task.
whenobjectVisit Conditional Tasks and Actions page to learn how to execute task conditionally.
targetstringSpecifies the target which contains the plist file. Omitting this field means the plist of main app will be modified.
actionsArray<Action>, requiredAn array of action items that define the modifications to be made in the file.

Action Properties

PropertyTypeDescription
namestringAn optional name for the task. If provided, the task state will be saved as a variable. Visit Task and Action States page to learn more.
whenobjectVisit Conditional Tasks and Actions page to learn how to execute action conditionally.
setobjectAn object containing key-value pairs that you want to add or modify in the plist.
strategyone of StrategySpecifies how to handle merging new and existing values.

Strategy Property

  • assign: (default) Overwrites the entire key with the new value.
  • append: Appends values only if the key does not already exist.
  • merge: Merges new values into existing dictionaries.
  • merge_concat: Merges dictionaries while concatenating arrays.
  • merge_distinct: Merges dictionaries while ensuring that objects with deep equality are distinct.

Example

task: plist
label: Add or Modify Plist Entries
actions:
- set:
MY_KEY: "my value"
ANOTHER_KEY: "another value"
strategy: assign
- set:
NEW_KEY: "new value"
strategy: merge

In this example, the plist task is used to add or modify entries in a plist file. Two actions are specified:

  1. The first action sets the value of MY_KEY to "my value" using the assign strategy, which overwrites the value if it already exists.
  2. The second action sets the value of NEW_KEY to "new value" using the merge strategy, which merges new values into existing dictionaries.

The plist task provides a flexible way to modify plist files in your iOS project, enabling you to tailor your app's behavior to your needs.