Xcode Task Configuration (xcode)
Modify Xcode project
The "xcode" task is used to manage the iOS xcode project. This task allows you to specify which resources to add and where to add them, either to the root level of the iOS project or to specific target groups within the project.
Task Properties
| Property | Type | Description |
|---|---|---|
| task | "xcode", required | Specifies the task type, which should be set to "xcode" for this task. |
| name | string | An 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. |
| label | string | An optional label or description for the task. |
| when | object | Visit Conditional Tasks and Actions page to learn how to execute task conditionally. |
| actions | Array<Action>, required | An array of action items that define the modifications to be made in the file. Each action item contains the following fields: |
Action Properties
Common properties
| Property | Type | Description |
|---|---|---|
| name | string | An 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. |
| when | object | Visit Conditional Tasks and Actions page to learn how to execute action conditionally. |
The action item can take these properties based on which action you want to execute.
Add a resource file
| Property | Type | Description |
|---|---|---|
| addFile | string | Specifies the resource file to be added. It can be a string representing the resource file name. |
| message | string | A string that serves as the user prompt message when collecting input for file to copy. If provided, this message will replace the default message. |
| target | Target | Specifies the target group within the iOS project where the resource should be added. |
Target Property
Specifies the target group within the iOS project where the resource should be added. It can take the listed values.
root: (default) Adds the resource to the project rootmain: Adds the resource to the main application group- Or target name or path to add the resource
Add a new target
| Property | Type | Description |
|---|---|---|
| addTarget | string | Specifies the target name to be added. |
| type | "notification-service" or "notification-content" | Specifies target type to be added. "notification-service" adds Notification Service Extension and "notification-content" adds Notification Content Extension. |
| message | string | Specifies the message when requesting the target name from the user. |
name must be specified for this action or you will get a validation error.
This action will expose the name.target variable which will hold the name of the target which was entered by the user.
For example:
# add a notification service extension
# with the default name `MyNotificationService`.
# User can change this when running this action!
- addTarget: MyNotificationService
name: notificationsv # Give it a name
type: notification-service
# set extension version to same as main target
- setDeploymentVersion: $[IOS_DEPLOYMENT_VERSION]
target: $[notificationsv.target] # use the name here
Add new capability to a target
| Property | Type | Description |
|---|---|---|
| addCapability | one of Capability | Specifies the capability to be added |
| groups | Array<string> | Required when addCapability is set to groups or keychain-sharing |
| domains | Array<string> | Required when addCapability is set to domains |
| modes | Array<BackgroundMode> | Required when addCapability is set to background-mode. |
| controllers | Array<Controller> | Required when addCapability is set to game-controllers |
| routing | Array<Routing> | Required when addCapability is set to maps. |
| target | string | Specifies the target group within the iOS project where the capability should be added. Setting "main" adds the capability to the main target, otherwise defines the target name or path to add the capability to |
Capability
push: Push Notificationwireless-configurationapp-attestdata-protectionhomekithealthkitinter-app-audioincreased-memorygroups: App Groups. Additionalgroupsfield is required.domains: App Domains. Additionaldomainsfield is required.keychain-sharing: Additionalgroupsfield is required.background-mode: Additionalmodesfield is required.game-controllers: Additionalcontrollersfield is required.maps: Additionalroutingfield is required.
BackgroundMode
audiobluetooth-centralbluetooth-peripheralexternal-accessoryfetchlocationnearby-interactionprocessingpush-to-talkremote-notificationvoip
Controller
extendedmicrodirectional
Routing
bikebuscarferryotherpedestrianplaneride-sharestreet-carsubwaytaxitrain
Set deployment version
| Property | Type | Description |
|---|---|---|
| setDeploymentVersion | DeploymentVersion | Specifies the version to set. |
| target | Target | Specifies the target group within the iOS project where the resource should be added. |
DeploymentVersion
string: String representation of the version. Can also be a variable in$[variable]form.number: Version number(object):min: Minimum version to set. The target version is set only if it is lower than this value.max: Maximum version to set. The target version is set only if it is higher than this value.
Add configuration
| Property | Type | Description |
|---|---|---|
| addConfiguration | string or {file: string} | Creates or updates xcconfig configuration file. It can be a string or an object with a file field that points to a file containing the code to append. |
Add pre build run script action
| Property | Type | Description |
|---|---|---|
| addPreBuildRunScriptAction | string or {file: string} | Adds a pre build run script action into shared scheme. It can be a string or an object with a file field that points to a file containing the code to append. |
Custom script action
| Property | Type | Description |
|---|---|---|
| script | string or (project: XcodeProject) => any | Run custom js using xcode project from xcode module. You can define as string in yml to evaluate or as function in your modules or other scripts. |
Usage Example
task: xcode
actions:
- addFile: "GoogleService-Info.plist"
target: root
- addTarget: OneSignalNotificationService
type: notification-extension
In this example, a resource and a new target, GoogleService-Info.plist and OneSignalNotificationService are specified for addition. The target
field distinguishes the target groups within the iOS project where each resource should be placed.