Skip to content

STRUCT

Target

Contents

  • Properties
    • name
    • destinations
    • product
    • productName
    • bundleId
    • deploymentTargets
    • infoPlist
    • buildableFolders
    • sources
    • playgrounds
    • resources
    • copyFiles
    • headers
    • entitlements
    • scripts
    • dependencies
    • ignoreDependencies
    • prioritizeDependencies
    • settings
    • coreDataModels
    • environmentVariables
    • launchArguments
    • additionalFiles
    • preCreatedFiles
    • buildRules
    • mergedBinaryType
    • mergeable
    • filesGroup
    • prune
  • Methods
    • init(name:destinations:product:productName:bundleId:deploymentTargets:infoPlist:buildableFolders:sources:playgrounds:resources:copyFiles:headers:entitlements:scripts:dependencies:ignoreDependencies:prioritizeDependencies:settings:coreDataModels:environmentVariables:launchArguments:additionalFiles:preCreatedFiles:buildRules:mergedBinaryType:mergeable:filesGroup:)
    • ==(_:_:)
    • hash(into:)
    • <(_:_:)
    • encode(to:)
    • init(from:)
swift
public struct Target: Codable, Equatable, Hashable, Comparable

A target of a project.

Properties

name

swift
public var name: String

The name of the target. Also, the product name if not specified with productName.

destinations

swift
public var destinations: Destinations

The destinations this target supports, e.g. iPhone, appleVision, macCatalyst

product

swift
public var product: Product

The type of build product this target will output.

productName

swift
public var productName: String

The built product name. If nil, it will be equal to name.

bundleId

swift
public var bundleId: String?

The product bundle identifier.

deploymentTargets

swift
public var deploymentTargets: DeploymentTargets

The minimum deployment targets your product will support.

infoPlist

swift
public var infoPlist: InfoPlist?

The Info.plist representation.

buildableFolders

swift
public var buildableFolders: [BuildableFolder]

Buildable folders of the target.

sources

swift
public var sources: [SourceFiles]

The source files of the target. Note: any playgrounds matched by the globs used in this property will be automatically added.

playgrounds

swift
public var playgrounds: [FilePath]

resources

swift
public var resources: [ResourceFileElement]

The resource files of target. Note: localizable files, *.lproj, are supported.

copyFiles

swift
public var copyFiles: [CopyFilesAction]

The build phase copy files actions for the target.

headers

swift
public var headers: HeadersList?

The headers for the target.

entitlements

swift
public var entitlements: Entitlements?

The entitlements representation

scripts

swift
public var scripts: [TargetScript]

The build phase scripts actions for the target.

dependencies

swift
public var dependencies: [TargetDependency]

The target's dependencies.

ignoreDependencies

swift
public var ignoreDependencies: [TargetDependency]

Dependencies to ignore. Can be useful to disable unwanted transitive dependency.

prioritizeDependencies

swift
public var prioritizeDependencies: [TargetDependency]

Dependencies to prioritize in link phase. Every dependency listed here will be at the start of the 'Link Binary With Libraries' phase in the same order.

settings

swift
public var settings: Settings?

The target's settings.

coreDataModels

swift
public var coreDataModels: [CoreDataModel]

The Core Data models.

environmentVariables

swift
public var environmentVariables: [String: EnvironmentVariable]

The environment variables. Used by autogenerated schemes for the target.

launchArguments

swift
public var launchArguments: [LaunchArgument]

The launch arguments. Used by autogenerated schemes for the target.

additionalFiles

swift
public var additionalFiles: [FileElement]

The additional files for the target. For project's additional files, see Project/additionalFiles.

preCreatedFiles

swift
public var preCreatedFiles: [String]

These files will be created before project generation

buildRules

swift
public var buildRules: [BuildRule]

The build rules used for transformation of source files during compilation.

mergedBinaryType

swift
public var mergedBinaryType: MergedBinaryType

Specifies whether if the target can merge or not the dynamic dependencies as part of its binary

mergeable

swift
public var mergeable: Bool

Specifies whether if the target can be merged as part of another binary or not

filesGroup

swift
public var filesGroup: ProjectGroup

prune

swift
public var prune: Bool

Methods

init(name:destinations:product:productName:bundleId:deploymentTargets:infoPlist:buildableFolders:sources:playgrounds:resources:copyFiles:headers:entitlements:scripts:dependencies:ignoreDependencies:prioritizeDependencies:settings:coreDataModels:environmentVariables:launchArguments:additionalFiles:preCreatedFiles:buildRules:mergedBinaryType:mergeable:filesGroup:)

swift
public init(
    name: String,
    destinations: Destinations,
    product: Product,
    productName: String? = nil,
    bundleId: String? = nil,
    deploymentTargets: DeploymentTargets? = nil,
    infoPlist: InfoPlist? = .default,
    buildableFolders: [BuildableFolder] = [],
    sources: SourceFilesList? = nil,
    playgrounds: [FilePath] = [],
    resources: ResourceFileElements? = nil,
    copyFiles: [CopyFilesAction]? = nil,
    headers: HeadersList? = nil,
    entitlements: Entitlements? = nil,
    scripts: [TargetScript] = [],
    dependencies: [TargetDependency] = [],
    ignoreDependencies: [TargetDependency] = [],
    prioritizeDependencies: [TargetDependency] = [],
    settings: Settings? = nil,
    coreDataModels: [CoreDataModel] = [],
    environmentVariables: [String: EnvironmentVariable] = [:],
    launchArguments: [LaunchArgument] = [],
    additionalFiles: [FileElement] = [],
    preCreatedFiles: [String] = [],
    buildRules: [BuildRule] = [],
    mergedBinaryType: MergedBinaryType = .disabled,
    mergeable: Bool = false,
    filesGroup: ProjectGroup = .group(name: "Project")
)

==(_:_:)

swift
public static func == (lhs: Target, rhs: Target) -> Bool

Parameters

NameDescription
lhsA value to compare.
rhsAnother value to compare.

hash(into:)

swift
public func hash(into hasher: inout Hasher)

Parameters

NameDescription
hasherThe hasher to use when combining the components of this instance.

<(_:_:)

swift
public static func < (lhs: Target, rhs: Target) -> Bool

Parameters

NameDescription
lhsA value to compare.
rhsAnother value to compare.

encode(to:)

swift
public func encode(to encoder: Encoder) throws

Parameters

NameDescription
encoderThe encoder to write data to.

init(from:)

swift
public init(from decoder: Decoder) throws

Parameters

NameDescription
decoderThe decoder to read data from.