Skip to content

STRUCT

Project

Contents

  • Properties
    • name
    • organizationName
    • classPrefix
    • options
    • packages
    • targets
    • schemes
    • settings
    • fileHeaderTemplate
    • additionalFiles
    • resourceSynthesizers
    • containsExternalDependencies
  • Methods
    • init(name:organizationName:classPrefix:options:packages:settings:targets:schemes:fileHeaderTemplate:additionalFiles:resourceSynthesizers:)
swift
public struct Project: Codable, Equatable, Sendable

A project representation.

A project manifest needs to be defined in a Project.swift manifest file. Manifests need to import the framework ProjectDescription which contains all the classes and enums that are available for you to describe your projects.

The snippet below shows an example project manifest:

swift
import ProjectDescription

let project = Project(
    name: "MyProject",
    organizationName: "MyOrg",
    targets: [
        Target(
            name: "App",
            destinations: .iOS,
            product: .app,
            bundleId: "io.tuist.App",
            infoPlist: "Config/App-Info.plist",
            sources: ["Sources/**"],
            resources: [
                "Resources/**",
                .folderReference(path: "Stubs"),
                .folderReference(path: "ODR", tags: ["odr_tag"])
            ],
            headers: .headers(
                public: ["Sources/public/A/**", "Sources/public/B/**"],
                private: "Sources/private/**",
                project: ["Sources/project/A/**", "Sources/project/B/**"]
            ),
            dependencies: [
                .project(target: "Framework1", path: "../Framework1"),
                .project(target: "Framework2", path: "../Framework2")
            ]
        )
    ],
    schemes: [
        Scheme(
            name: "App-Debug",
            shared: true,
            buildAction: .buildAction(targets: ["App"]),
            testAction: .targets(["AppTests"]),
            runAction: .runAction(executable: "App")
        ),
        Scheme(
            name: "App-Release",
            shared: true,
            buildAction: .buildAction(targets: ["App"]),
            runAction: .runAction(executable: "App")
        )
    ],
    additionalFiles: [
        "Dangerfile.swift",
        "Documentation/**",
        .folderReference(path: "Website")
    ]
)

Properties

name

swift
public let name: String

The name of the project. Also, the file name of the generated Xcode project.

organizationName

swift
public let organizationName: String?

The name of the organization used by Xcode as copyright.

classPrefix

swift
public let classPrefix: String?

The prefix for class files Xcode generates when you create a project or class file.

options

swift
public let options: Options

The project options.

packages

swift
public let packages: [Package]

The Swift Packages used by the project.

targets

swift
public let targets: [Target]

The targets of the project.

schemes

swift
public let schemes: [Scheme]

The custom schemes for the project. Default schemes for each target are generated by default.

settings

swift
public let settings: Settings?

The build settings and configuration for the project.

fileHeaderTemplate

swift
public let fileHeaderTemplate: FileHeaderTemplate?

The custom file header template for Xcode built-in file templates.

additionalFiles

swift
public let additionalFiles: [FileElement]

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

resourceSynthesizers

swift
public let resourceSynthesizers: [ResourceSynthesizer]

The resource synthesizers for the project to generate accessors for resources.

containsExternalDependencies

swift
public var containsExternalDependencies: Bool

The project contains targets that depend on external dependencies

Methods

init(name:organizationName:classPrefix:options:packages:settings:targets:schemes:fileHeaderTemplate:additionalFiles:resourceSynthesizers:)

swift
public init(
    name: String,
    organizationName: String? = nil,
    classPrefix: String? = nil,
    options: Options = .options(),
    packages: [Package] = [],
    settings: Settings? = nil,
    targets: [Target] = [],
    schemes: [Scheme] = [],
    fileHeaderTemplate: FileHeaderTemplate? = nil,
    additionalFiles: [FileElement] = [],
    resourceSynthesizers: [ResourceSynthesizer] = .default
)

Released under the MIT License.