Manifest
public final class Manifest: Codable
An interface for a package’s manifest.
-
The current environment that the
Manifestis being used in.Declaration
Swift
public static var environment: Environment = .commandline -
Gets the current project’s manifest.
Declaration
Swift
public static var current: Manifest -
A custom path to the manifest. This property gets set to
./Package.swiftwhen the static.currentproperty is used.Declaration
Swift
public let path: String? -
Data that acts as the manifest file.
Declaration
Swift
public private(set) var data: Data? -
Declaration
Swift
public init(path: String) -
Declaration
Swift
public init(data: Data) -
Declaration
Swift
public required init(from decoder: Decoder) throws -
Declaration
Swift
public func encode(to encoder: Encoder) throws -
Gets the contents of the project’s manifest as
Data.Throws
Errors that occur if there is a badly formed URL or the manifest is not found.Declaration
Swift
public func contents()throws -> DataReturn Value
The manifest’s contents.
-
Gets the contents of the project’s manifest as an
NSMutableString.Throws
Errors that occur if there is a badly formed URL or the manifest is not found.Declaration
Swift
public func contents()throws -> NSMutableStringReturn Value
The manifest’s contents.
-
Gets the contents of the project’s manifest as a
String.Throws
Errors that occur if there is a badly formed URL or the manifest is not found.Declaration
Swift
public func contents()throws -> StringReturn Value
The manifest’s contents.
-
Rewrites the contents of the package’s manifest.
Throws
ManifestError.badURLif the URL to the manifest cannot be created.Declaration
Swift
public func write(with string: String)throwsParameters
stringThe data to rewrite the manifest with.
-
Rewrites the contents of the package’s manifest.
Throws
ManifestError.badURLif the URL to the manifest cannot be created.Declaration
Swift
public func write(with string: NSMutableString)throwsParameters
stringThe string to rewrite the manifest with.
-
Rests the manifest to its orginal state when the project was created without extraneous comments or whitespace.
Throws
Errors when reading or writing the manifest.Declaration
Swift
public func reset()throws
-
Get all the elements in
Package.dependenciesarray from the project’s manifest.Throws
Errors that occur when creating a RegEx pattern or reading or writing the manifest.Declaration
Swift
public func dependencies()throws -> [Dependency]Return Value
Package.dependencies -
Get an element in
Package.dependenciesarray from the project’s manifest.Throws
Errors that occur when creating a RegEx pattern or reading or writing the manifest.
Declaration
Swift
public func dependency(withURL url: String)throws -> Dependency?Parameters
urlThe URL of the dependency to fetch.
Return Value
Package.dependencies
-
Gets the name of the
Packagedeclaration in the project’s manifest.Throws
Errors that occur when creating a RegEx pattern or reading or writing the manifest.Declaration
Swift
public func name(equals name: String? = nil)throws -> StringParameters
nameA new name for the
Packagedeclaration. Ifnilis passed in, the name remains the same.Return Value
The value passed into the manifest’s
Packageinitializer. -
Gets the value of the
Package.pkgConfigproperty.Throws
Errors that occur when creating a RegEx pattern or reading or writing the manifest.Declaration
Swift
public func packageConfig()throws -> String?Return Value
Package.pkgConfig -
Sets the value of the
Package.pkgConfigproperty in the project’s manifest.Throws
Errors that occur when creating a RegEx pattern or reading or writing the manifest.Declaration
Swift
public func packageConfig(equals string: String?)throwsParameters
stringThe new value for
Package.pkgConfig.
-
Keys for encoding a
Manifestinstance.Declaration
Swift
public typealias CodingKeys = ManifestCodingKeys
-
Gets a single
Productinstances from the current manifest.Declaration
Swift
public func product(as type: ProductType = .library, withName name: String)throws -> Product?Parameters
typeWheather the product is an
executableorlibrary(default).nameThe name of the product to fetch.
-
Get all the elements in
Package.providersfrom the project’s manifest.Throws
Errors that occur when creating a RegEx pattern or reading or writing the manifest.Declaration
Swift
public func providers()throws -> [Provider]Return Value
Package.providers
-
Gets the contents of the package’s
Package.resolvedfile as a data structure.Throws
ManifestError.badPathif the path to the.resolvedfile is malformed.Declaration
Swift
public func resolved()throws -> ResolvedReturn Value
The contents of the packages
.resolvedfile. -
Gets the data from the package’s
.resolvedfile about a package with a given name.Throws
Errors that occur when fetching the data.Declaration
Swift
public func package(withName name: String)throws -> Pin?Parameters
nameThe name of the package to fetch.
Return Value
The package’s pin data.
-
Gets the data from the package’s
.resolvedfile about a package with a given repository URL.Throws
Errors that occur when fetching the data.Declaration
Swift
public func package(withURL url: String)throws -> Pin?Parameters
nameThe URL of the package to fetch.
Return Value
The package’s pin data.
-
Gets the targets declared in the project’s manifest.
Throws
Errors that occur while fetching the manifest contents or create the regex for maching the targets.Declaration
Swift
public func targets()throws -> [Target]Return Value
The project’s targets parsed into data structures.
-
Gets a target declared in the project’s manifest.
Throws
Errors that occur while fetching the manifest contents or create the regex for maching the targets.
Declaration
Swift
public func target(test: Bool = false, withName name: String)throws -> Target?Parameters
testWheather the target to fetch is a test target or not.
nameThe name of the target to fetch.
Return Value
The project’s targets parsed into data structures.
Manifest Class Reference