Skip to content

STRUCT

Config

Contents

  • Properties
    • generationOptions
    • installOptions
    • compatibleXcodeVersions
    • plugins
    • cloud
    • cache
    • swiftVersion
    • preFetchScripts
    • preGenerateScripts
    • postGenerateScripts
    • cocoapodsUseBundler
  • Methods
    • init(compatibleXcodeVersions:cloud:cache:swiftVersion:plugins:generationOptions:installOptions:preFetchScripts:preGenerateScripts:postGenerateScripts:cocoapodsUseBundler:)
    • hash(into:)
swift
public struct Config: Codable, Equatable

The configuration of your environment.

Geko can be configured through a shared Config.swift manifest. When Geko is executed, it traverses up the directories to find a Geko directory containing a Config.swift file. Defining a configuration manifest is not required, but recommended to ensure a consistent behaviour 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 Geko is run from any of the subdirectories:

bash
/Workspace.swift
/Geko/Config.swift # Configuration manifest
/Framework/Project.swift
/App/Project.swift

That way, when executing Geko in any of the subdirectories, it will use the shared configuration.

The snippet below shows an example configuration manifest:

swift
import ProjectDescription

let config = Config(
    compatibleXcodeVersions: ["14.2"],
    swiftVersion: "5.7.0"
)

Properties

generationOptions

swift
public var generationOptions: GenerationOptions

Generation options.

installOptions

swift
public let installOptions: InstallOptions

List of options to use when running geko fetch.

compatibleXcodeVersions

swift
public var compatibleXcodeVersions: CompatibleXcodeVersions

Set the versions of Xcode that the project is compatible with.

plugins

swift
public var plugins: [PluginLocation]

List of Plugins used to extend Geko.

cloud

swift
public var cloud: Cloud?

Cloud configuration.

cache

swift
public var cache: Cache?

Cache configuration.

swiftVersion

swift
public var swiftVersion: Version?

The Swift tools versions that will be used by Geko to fetch external dependencies. If nil is passed then Geko will use the environment’s version.

  • Note: This does not control the SWIFT_VERSION build setting in regular generated projects, for this please use Project.settings or Target.settings as needed.

preFetchScripts

swift
public var preFetchScripts: [Script]

Scripts that are executed before fetch phase. Executed in the same order as declared.

preGenerateScripts

swift
public var preGenerateScripts: [Script]

Scripts that are executed before generation phase. Executed in the same order as declared.

postGenerateScripts

swift
public var postGenerateScripts: [Script]

Scripts that are executed after generation phase. Executed in the same order as declared.

cocoapodsUseBundler

swift
public var cocoapodsUseBundler: Bool

Set to true when cocoapods is used through bundler

Methods

init(compatibleXcodeVersions:cloud:cache:swiftVersion:plugins:generationOptions:installOptions:preFetchScripts:preGenerateScripts:postGenerateScripts:cocoapodsUseBundler:)

swift
public init(
    compatibleXcodeVersions: CompatibleXcodeVersions = .all,
    cloud: Cloud? = nil,
    cache: Cache? = nil,
    swiftVersion: Version? = nil,
    plugins: [PluginLocation] = [],
    generationOptions: GenerationOptions = .options(),
    installOptions: InstallOptions = .options(),
    preFetchScripts: [Script] = [],
    preGenerateScripts: [Script] = [],
    postGenerateScripts: [Script] = [],
    cocoapodsUseBundler: Bool = false
)

Creates a geko configuration.

  • Parameters:
    • compatibleXcodeVersions: List of Xcode versions the project is compatible with.
    • cloud: Cloud configuration.
    • cache: Cache configuration.
    • swiftVersion: The version of Swift that will be used by Geko.
    • plugins: A list of plugins to extend Geko.
    • generationOptions: List of options to use when generating the project.
    • preFetchScripts: Scripts that are executed before fetch phase. Executed in the same order as declared.
    • preGenerateScripts: Scripts that are executed before generation phase. Executed in the same order as declared.
    • postGenerateScripts: Scripts that are executed after generation phase. Executed in the same order as declared.
    • cocoapodsUseBundler: if passed then will use bundler to work with Cocoapods

Parameters

NameDescription
compatibleXcodeVersionsList of Xcode versions the project is compatible with.
cloudCloud configuration.
cacheCache configuration.
swiftVersionThe version of Swift that will be used by Geko.
pluginsA list of plugins to extend Geko.
generationOptionsList of options to use when generating the project.
preFetchScriptsScripts that are executed before fetch phase. Executed in the same order as declared.
preGenerateScriptsScripts that are executed before generation phase. Executed in the same order as declared.
postGenerateScriptsScripts that are executed after generation phase. Executed in the same order as declared.
cocoapodsUseBundlerif passed then will use bundler to work with Cocoapods

hash(into:)

swift
public func hash(into hasher: inout Hasher)