<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Package",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription0A0C"
  },
  "title" : "Package"
}
-->

# Package

The configuration of a Swift package.

```
final class Package
```

## Overview

Pass configuration options as parameters to your package’s initializer
statement to provide the name of the package, its targets, products,
dependencies, and other configuration options.

By convention, you need to define the properties of a package in a single
nested initializer statement. Don’t modify it after initialization. The
following package manifest shows the initialization of a simple package
object for the MyLibrary Swift package:

```swift
// swift-tools-version:5.3
import PackageDescription

let package = Package(
    name: "MyLibrary",
    platforms: [
        .macOS(.v10_15),
    ],
    products: [
        .library(name: "MyLibrary", targets: ["MyLibrary"])
    ],
    dependencies: [
        .package(url: "https://url/of/another/package/named/utility", from: "1.0.0")
    ],
    targets: [
        .target(name: "MyLibrary", dependencies: ["Utility"]),
        .testTarget(name: "MyLibraryTests", dependencies: ["MyLibrary"])
    ]
)
```

In Swift tools versions earlier than 5.4, the package manifest must begin with the string `// swift-tools-version:`
followed by a version number specifier. Version 5.4 and later has relaxed the whitespace requirements.
The following code listing shows a few examples of valid declarations of the Swift tools version:

```swift
// swift-tools-version:3.0.2
// swift-tools-version:3.1
// swift-tools-version:4.0
// swift-tools-version:5.3
// swift-tools-version: 5.6
```

The Swift tools version declares the version of the `PackageDescription`
library, the minimum version of the Swift tools and Swift language
compatibility version to process the manifest, and the required minimum
version of the Swift tools to use the Swift package. Each version of Swift
can introduce updates to the PackageDescription framework, but the previous
API version is available to packages which declare a prior tools version.
This behavior means you can take advantage of new releases of Swift, the Swift
tools, and the PackageDescription library, without having to update your
package’s manifest or losing access to existing packages.

## Topics

### Creating a Package

[`init(name:defaultLocalization:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageModes:cLanguageStandard:cxxLanguageStandard:)`](/documentation/PackageDescription/Package/init(name:defaultLocalization:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageModes:cLanguageStandard:cxxLanguageStandard:))

Initializes a Swift package with configuration options you provide.

[`init(name:defaultLocalization:platforms:pkgConfig:providers:products:traits:dependencies:targets:swiftLanguageModes:cLanguageStandard:cxxLanguageStandard:)`](/documentation/PackageDescription/Package/init(name:defaultLocalization:platforms:pkgConfig:providers:products:traits:dependencies:targets:swiftLanguageModes:cLanguageStandard:cxxLanguageStandard:))

Initializes a Swift package with configuration options you provide.

[`init(name:defaultLocalization:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)`](/documentation/PackageDescription/Package/init(name:defaultLocalization:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:))

Initializes a Swift package with configuration options you provide.

[`init(name:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)`](/documentation/PackageDescription/Package/init(name:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:))

Initializes a Swift package with configuration options you provide.

[`init(name:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)`](/documentation/PackageDescription/Package/init(name:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)-7ld3y)

Initializes a Swift package with configuration options you provide.

[`init(name:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)`](/documentation/PackageDescription/Package/init(name:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)-767rj)

Initializes a Swift package with configuration options you provide.

### Naming the Package

[`name`](/documentation/PackageDescription/Package/name)

The name of the Swift package.

### Localizing Package Resources

[`defaultLocalization`](/documentation/PackageDescription/Package/defaultLocalization)

The default localization for resources.

[`LanguageTag`](/documentation/PackageDescription/LanguageTag)

A wrapper around an IETF language tag.

### Configuring Products

[`products`](/documentation/PackageDescription/Package/products)

The list of products that this package vends and that clients can use.

[`Product`](/documentation/PackageDescription/Product)

The object that defines a package product.

### Configuring Targets

[`targets`](/documentation/PackageDescription/Package/targets)

The list of targets that are part of this package.

[`Target`](/documentation/PackageDescription/Target)

The basic building block of a Swift package.

### Declaring Supported Platforms

[`platforms`](/documentation/PackageDescription/Package/platforms)

The list of minimum versions for platforms supported by the package.

[`SupportedPlatform`](/documentation/PackageDescription/SupportedPlatform)

A platform that the Swift package supports.

[`Platform`](/documentation/PackageDescription/Platform)

A platform supported by Swift Package Manager.

### Configuring System Packages

[`SystemPackageProvider`](/documentation/PackageDescription/SystemPackageProvider)

The system package providers that this package uses.

[`pkgConfig`](/documentation/PackageDescription/Package/pkgConfig)

The name to use for C modules.

[`providers`](/documentation/PackageDescription/Package/providers)

An array of providers for a system target.

### Configuring Traits

[`traits`](/documentation/PackageDescription/Package/traits)

The set of traits this package provides.

[`Trait`](/documentation/PackageDescription/Trait)

A package trait.

### Declaring Package Dependencies

[`dependencies`](/documentation/PackageDescription/Package/dependencies)

The list of package dependencies.

[`Package.Dependency`](/documentation/PackageDescription/Package/Dependency)

A package dependency of a Swift package.

### Declaring Supported Languages

[`SwiftLanguageMode`](/documentation/PackageDescription/SwiftLanguageMode)

The Swift language mode used to compile Swift sources in the package

[`CLanguageStandard`](/documentation/PackageDescription/CLanguageStandard)

The supported C language standard you use to compile C sources in the
package.

[`CXXLanguageStandard`](/documentation/PackageDescription/CXXLanguageStandard)

The supported C++ language standard you use to compile C++ sources in the
package.

[`swiftLanguageModes`](/documentation/PackageDescription/Package/swiftLanguageModes)

The list of Swift language modes with which this package is compatible.

[`cLanguageStandard`](/documentation/PackageDescription/Package/cLanguageStandard)

The C language standard to use for all C targets in this package.

[`cxxLanguageStandard`](/documentation/PackageDescription/Package/cxxLanguageStandard)

The C++ language standard to use for all C++ targets in this package.

[`SwiftVersion`](/documentation/PackageDescription/SwiftVersion)

Type alias to previous name for backward source compatibility

[`swiftLanguageVersions`](/documentation/PackageDescription/Package/swiftLanguageVersions)

Legacy property name, accesses value of `swiftLanguageModes`



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)