许可证
Swift 许可证基于 Apache 2.0 许可证,并附带运行时库例外条款,该条款在使用 Swift 构建和分发您自己的二进制文件时,免除了署名要求。选择 Apache 2.0 许可证是因为它允许 Swift 的广泛使用,并且已被许多潜在的贡献者充分理解。
版权归贡献的作者,或个人所属的公司或组织所有。版权持有者列表维护在 上的 CONTRIBUTORS.txt 文件以及存储库的根目录中。
运行时库例外条款
运行时库例外条款明确指出,Swift 编译器的最终用户在使用 Swift 构建完成的二进制应用程序、游戏或服务时,无需署名。Swift 语言的最终用户应该感到可以不受限制地创建出色的软件。此例外条款的全文如下:
As an exception, if you use this Software to compile your source code and
portions of this Software are embedded into the binary product as a result,
you may redistribute such product without providing attribution as would
otherwise be required by Sections 4(a), 4(b) and 4(d) of the License.
此例外条款也可以在 LICENSE.txt 文件的底部找到。
源代码中的版权和许可证
所有托管在 上的源文件都必须在文件顶部包含一个注释块,声明适用的许可证和版权。此文本可以是较大标头的一部分,例如在 [贡献代码][contributing_code] 章节中定义的。无论标头格式如何,许可证和版权部分的措辞都必须按如下方式复制,并应用适当的年份:
// This source file is part of the open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swiftlang.cn/LICENSE.txt for license information
// See https://swiftlang.cn/CONTRIBUTORS.txt for the list of Swift project authors