Skip to main content

Config.swift

Tuist can be configured through a Config.swift manifest. When Tuist is executed, it traverses up the directories to find a Tuist directory that contains a Config.swift file. Defining a configuration manifest is not required but recommended to ensure a consistent behavior across all the projects that are part of the repository.

The example below shows a project that has a global Config.swift file that will be used when Tuist is run from any of the subdirectories:

/.git.gitignore/Tuist/Config.swift # Configuration manifest/Framework/Project.swift/App/Project.swift

That way, when Tuist runs in any of the subdirectories, it'll use the root configuration.

The structure is similar to the project manifest. We need to create a root variable, config of type Config:

import ProjectDescription
let config = Config(    compatibleXcodeVersions: ["10.3"],    swiftVersion: "5.4.0",    generationOptions: [        .xcodeProjectName("SomePrefix-\(.projectName)-SomeSuffix"),        .organizationName("Tuist"),        .developmentRegion("de")    ])

Config#

It allows configuring Tuist and share the configuration across several projects.

PropertyDescriptionTypeRequiredDefault
compatibleXcodeVersionsSet the versions of Xcode that the project is compatible with.CompatibleXcodeVersionsNo.all
swiftVersionThe specified version of Swift that will be used by Tuist. When nil is passed then Tuist will use the environment’s version.VersionNo
generationOptionsOptions to configure the generation of Xcode projects.[GenerationOption]No[]

Compatible Xcode versions#

This object represents the versions of Xcode the project is compatible with. If a developer tries to generate a project and its selected Xcode version is not compatible with the project, Tuist will yield an error:

CaseDescription
.allThe project is compatible with any version of Xcode.
.list([String])The project is compatible with a list of Xcode versions.
ExpressibleByArrayLiteral and ExpressibleByStringLiteral

Note that 'CompatibleXcodeVersions' can also be initialized with a string or array of strings that represent the supported Xcode versions.

GenerationOption#

Generation options allow customizing the generation of Xcode projects.

CaseDescription
.xcodeProjectName(TemplateString)Customize the name of the generated .xcodeproj.
.organizationName(String)Customize the organization name of the generated .xcodeproj.
.developmentRegion(String)Customize the development region of the generated .xcodeproj. The default development region is en.
.disableAutogeneratedSchemesGenerate only custom defined schemes, skip default auto generated schemes.
.disableShowEnvironmentVarsInScriptPhasesSuppress logging of environment in Run Script build phases.
.disableSynthesizedResourceAccessorsDo not automatically synthesize resource accessors (assets, localized strings, etc.).
.enableCodeCoverageEnable code coverage for auto generated schemes.
.templateMacros(IDETemplateMacros)Apply IDE Template macros to your project.
.resolveDependenciesWithSystemScmResolve SPM dependencies using your system's SCM credentials, instead of Xcode accounts.
.disablePackageVersionLockingDisables locking Swift packages. This can speed up generation but does increase risk if packages are not locked in their declarations.
.disableBundleAccessorsDisables generating Bundle accessors.

TemplateString#

Allows a string with interpolated properties to be specified. For example, Prefix-\(.projectname).

CaseDescription
.projectNameThe name of the current project.