Skip to content

STRUCT

Project ​

Contents

  • Properties
    • name
    • organizationName
    • options
    • targets
    • schemes
    • settings
    • fileHeaderTemplate
    • additionalFiles
    • path
    • sourceRootPath
    • xcodeProjPath
    • podspecPath
    • filesGroup
    • lastUpgradeCheck
    • isExternal
    • projectType
  • Methods
    • init(name:organizationName:options:settings:targets:schemes:fileHeaderTemplate:additionalFiles:)
    • hash(into:)
swift
public struct Project: Codable, Hashable

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",
            platform: .iOS,
            product: .app,
            bundleId: "io.geko.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 var name: String

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

organizationName ​

swift
public var organizationName: String?

The name of the organization used by Xcode as copyright.

options ​

swift
public var options: Options

The project options.

targets ​

swift
public var targets: [Target]

The targets of the project.

schemes ​

swift
public var schemes: [Scheme]

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

settings ​

swift
public var settings: Settings

The build settings and configuration for the project.

fileHeaderTemplate ​

swift
public var fileHeaderTemplate: FileHeaderTemplate?

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

additionalFiles ​

swift
public var additionalFiles: [FileElement]

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

path ​

swift
public var path: AbsolutePath

Path to the folder that contains the project manifest.

sourceRootPath ​

swift
public var sourceRootPath: AbsolutePath

Path to the root of the project sources.

xcodeProjPath ​

swift
public var xcodeProjPath: AbsolutePath

Path to the Xcode project that will be generated.

podspecPath ​

swift
public var podspecPath: AbsolutePath?

Path to podspec. Not nil if the project was generated from podspec.

filesGroup ​

swift
public var filesGroup: ProjectGroup

The group to place project files within

lastUpgradeCheck ​

swift
public var lastUpgradeCheck: Version?

The version in which a check happened related to recommended settings after updating Xcode.

isExternal ​

swift
public var isExternal: Bool

Indicates whether the project is imported through Dependencies.swift.

projectType ​

swift
public var projectType: ProjectType

Indicates the initialization type of this project

Methods ​

init(name:organizationName:options:settings:targets:schemes:fileHeaderTemplate:additionalFiles:) ​

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

hash(into:) ​

swift
public func hash(into hasher: inout Hasher)

Parameters ​

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