Target

public class Target: CustomStringConvertible, Codable

Represents a target declaration in a project’s manifest.

  • Keys for encoding/decoding a Target object.

    Declaration

    Swift

    public typealias CodingKeys = TargetCodingKeys
  • Wheather the target is for testing or not.

    Declaration

    Swift

    public let isTest: Bool
  • The name of the target.

    Declaration

    Swift

    public let name: String
  • The path to the target from the root of the project.

    Declaration

    Swift

    public var path: String?
  • The path to the directory containing public headers of a C target. Only valid for C family library targets.

    Declaration

    Swift

    public var publicHeadersPath: String?
  • The targets in the package or one of the packages dependencies that the declared target can access through imports.

    Declaration

    Swift

    public var dependencies: [String]
  • The files and directories that are excluded from being picked up as sources.

    Declaration

    Swift

    public var exclude: [String]
  • The source files to include in the target. If it is empty, then any valid source file is included.

    Declaration

    Swift

    public var source: [String]
  • The Targets instance that the target originates from.

    Declaration

    Swift

    public let manifest: Manifest
  • raw

    The raw string representation of the target’s declaration in the manifest.

    Declaration

    Swift

    public let raw: String
  • Creates a Target with a RegEx match from a String.

    Throws

    nameNotFound if the target has no name and .targetNotFound if no target is found in the contents with the match passed in.

    Declaration

    Swift

    public init(match: NSTextCheckingResult, in contents: String, with manifest: Manifest)throws

    Parameters

    match

    The RegEx match for the target.

    contents

    The String that the match was fetched from.

    parent

    The Targets model that is creating the Target.

  • Declaration

    Swift

    public init(
        isTest: Bool,
        name: String,
        path: String? = nil,
        publicHeadersPath: String? = nil,
        dependencies: [String] = [],
        exclude: [String] = [],
        source: [String] = [],
        manifest: Manifest? = nil
    )
  • Declaration

    Swift

    public required init(from decoder: Decoder) throws
  • The target formatted for the manifest.

    Declaration

    Swift

    public var description: String
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Updates the target’s instance in the projects manifest. If the instance does not exist yet, it will be created.

    Throws

    Errors that occur when creating a RegEx pattern or reading or writing the manifest.

    Declaration

    Swift

    public func save() throws
  • Removes the target instance from the manifest’s Package.targets array.

    Throws

    Errors that occur when creating a RegEx pattern or reading or writing the manifest.

    Declaration

    Swift

    public func delete() throws