swift-package-manager README

The project's README from github.com/swiftlang/swift-package-manager. As one markdown file: README.md.

Swift Package Manager Project

The Swift Package Manager is a tool for managing distribution of source code, aimed at making it easy to share your code and reuse others’ code. The tool directly addresses the challenges of compiling and linking Swift packages, managing dependencies, versioning, and supporting flexible distribution and collaboration models.

We’ve designed the system to make it easy to share packages on services like GitHub, but packages are also great for private personal development, sharing code within a team, or at any other granularity.

Swift Package Manager includes a build system that can build for macOS and Linux. Starting with Xcode 11, Xcode integrates with SwiftPM to provide support for including packages in iOS, macOS, watchOS, and tvOS applications.

The SourceKit-LSP project leverages libSwiftPM and provides Language Server Protocol implementation for editors that support LSP.


Table of Contents


Getting Started

Please use this guide for learning package manager basics.


Documentation

For Quick Help use the swift package --help command.

For documentation on using Swift Package Manager, creating packages, and more, see the Package Manager Docs.

For documentation on developing the Swift Package Manager itself, see the contribution guide.

For detailed documentation on the package manifest API, see PackageDescription API.

For release notes with information about changes between versions, see the release notes.


System Requirements

The package manager’s system requirements are the same as those for Swift with the caveat that the package manager requires Git at runtime as well as build-time.


Installation

The package manager is available as part the Swift toolchains available on Swift.org including snapshots for the latest versions built from main branch. For installation instructions for downloaded snapshots, please see the Getting Started section of Swift.org.

The Swift Package Manager is also included in Xcode 8.0 and all subsequent releases.

You can verify your installation by typing swift package --version in a terminal:

$ swift package --version
Apple Swift Package Manager - ...

Contributing

There are several ways to contribute to Swift Package Manager. To learn about the policies, best practices that govern contributions to the Swift project and instructions for setting up the development environment please read the Contributor Guide.

The Swift package manager uses llbuild as the underlying build system for compiling source files. It is also open source and part of the Swift project.


Reporting issues

If you have any trouble with the package manager, help is available. We recommend:

When reporting an issue please follow the bug reporting guidelines, they can be found in contribution guide.

If you’re not comfortable sharing your question with the list, contact details for the code owners can be found in CODEOWNERS; however, Swift Forums is usually the best place to go for help.


License

Copyright 2015 - 2025 Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception.

See https://swift.org/LICENSE.txt for license information.

See https://swift.org/CONTRIBUTORS.txt for Swift project authors.

swift-package-manager (swiftlang/swift-package-manager)

Searching Database…

这是什么?Swift Package Manager(SwiftPM)是 Swift 官方的工具,用于管理 Swift 源代码的分发,负责 Swift 包的编译、链接、依赖管理和版本管理。
它是独立的命令行工具,还是内置于 Xcode 中的?两者都是:它既是独立的命令行工具和构建系统,也直接集成在 Xcode 中(自 Xcode 8 起可用,自 Xcode 11 起提供完整的包支持)。
我该如何安装并开始使用?它包含在 Swift.org 提供的 Swift 工具链中(包括 main 分支的每夜快照版本),也内置于 Xcode 8 及以上版本。安装后,运行 'swift package --help' 查看命令,运行 'swift package --version' 确认版本。
运行它除了 Swift 工具链,还需要其他东西吗?需要。除了标准的 Swift 系统要求外,运行时和构建时都需要 Git。
能否直接通过命令行为所有 Apple 平台构建?命令行构建系统本身面向 macOS 和 Linux;iOS、watchOS 和 tvOS 的包支持则通过 Xcode 的集成提供,而不是独立的命令行构建。
它能在哪些平台上运行?它以命令行工具的形式在 macOS 和 Linux 上运行,并在 Xcode 中用于 iOS、macOS、watchOS 和 tvOS 应用开发。
SwiftPM 底层使用什么构建系统?它使用 Apple 自家的开源构建系统 llbuild 作为底层引擎来编译源文件。
编辑器能否为 Swift 包提供代码智能提示?可以。SourceKit-LSP 项目使用 libSwiftPM,为支持 LSP 的编辑器提供语言服务器协议(LSP)的实现。
What are similar projects?CocoaPods, Carthage, xmake, poetry, rye, composer, cargo, SwiftyJSON
Creator
swiftlang
Size
41.8 MB
Stars
10.2K
Age
10y
Commits · 90 Days