---
title: Package
framework: packagedescription
role: symbol
role_heading: Class
path: packagedescription/package
---

# Package

The configuration of a Swift package.

## Declaration

```swift
final class Package
```

## Overview

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-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-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:)](packagedescription/package/init(name:defaultlocalization:platforms:pkgconfig:providers:products:dependencies:targets:swiftlanguagemodes:clanguagestandard:cxxlanguagestandard:).md)
- [init(name:defaultLocalization:platforms:pkgConfig:providers:products:traits:dependencies:targets:swiftLanguageModes:cLanguageStandard:cxxLanguageStandard:)](packagedescription/package/init(name:defaultlocalization:platforms:pkgconfig:providers:products:traits:dependencies:targets:swiftlanguagemodes:clanguagestandard:cxxlanguagestandard:).md)
- [init(name:defaultLocalization:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)](packagedescription/package/init(name:defaultlocalization:platforms:pkgconfig:providers:products:dependencies:targets:swiftlanguageversions:clanguagestandard:cxxlanguagestandard:).md)
- [init(name:platforms:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)](packagedescription/package/init(name:platforms:pkgconfig:providers:products:dependencies:targets:swiftlanguageversions:clanguagestandard:cxxlanguagestandard:).md)
- [init(name:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)](packagedescription/package/init(name:pkgconfig:providers:products:dependencies:targets:swiftlanguageversions:clanguagestandard:cxxlanguagestandard:)-7ld3y.md)
- [init(name:pkgConfig:providers:products:dependencies:targets:swiftLanguageVersions:cLanguageStandard:cxxLanguageStandard:)](packagedescription/package/init(name:pkgconfig:providers:products:dependencies:targets:swiftlanguageversions:clanguagestandard:cxxlanguagestandard:)-767rj.md)

### Naming the Package

- [name](packagedescription/package/name.md)

### Localizing Package Resources

- [defaultLocalization](packagedescription/package/defaultlocalization.md)
- [LanguageTag](packagedescription/languagetag.md)

### Configuring Products

- [products](packagedescription/package/products.md)
- [Product](packagedescription/product.md)

### Configuring Targets

- [targets](packagedescription/package/targets.md)
- [Target](packagedescription/target.md)

### Declaring Supported Platforms

- [platforms](packagedescription/package/platforms.md)
- [SupportedPlatform](packagedescription/supportedplatform.md)
- [Platform](packagedescription/platform.md)

### Configuring System Packages

- [SystemPackageProvider](packagedescription/systempackageprovider.md)
- [pkgConfig](packagedescription/package/pkgconfig.md)
- [providers](packagedescription/package/providers.md)

### Configuring Traits

- [traits](packagedescription/package/traits.md)
- [Trait](packagedescription/trait.md)

### Declaring Package Dependencies

- [dependencies](packagedescription/package/dependencies.md)
- [Package.Dependency](packagedescription/package/dependency.md)

### Declaring Supported Languages

- [SwiftLanguageMode](packagedescription/swiftlanguagemode.md)
- [CLanguageStandard](packagedescription/clanguagestandard.md)
- [CXXLanguageStandard](packagedescription/cxxlanguagestandard.md)
- [swiftLanguageModes](packagedescription/package/swiftlanguagemodes.md)
- [cLanguageStandard](packagedescription/package/clanguagestandard.md)
- [cxxLanguageStandard](packagedescription/package/cxxlanguagestandard.md)
- [SwiftVersion](packagedescription/swiftversion.md)
- [swiftLanguageVersions](packagedescription/package/swiftlanguageversions.md)

## See Also

### Creating a Package

- [Context](packagedescription/context.md)
