如何在Playground中使用Swift Package Manager

时间:2022-06-06 11:53:14

Is it possible to use Swift Package Manager inside Xcode Playground ?

是否可以在Xcode Playground中使用Swift Package Manager?

1 个解决方案

#1


10  

It is not possible to use the Swift Package Manager in a playground at this time. The reason for that is that the Swift Package Manager is primarily used outside of apple platforms.

目前无法在游乐场中使用Swift Package Manager。原因是Swift Package Manager主要在Apple平台之外使用。

Apple mentions this on the Swift Package Manager's GitHub:

Apple在Swift Package Manager的GitHub上提到了这一点:

Note that at this time the Package Manager has no support for iOS, watchOS, or tvOS platforms

请注意,此时程序包管理器不支持iOS,watchOS或tvOS平台

The Swift Package Manager is especially useful for writing Swift for platforms such as Linux and Mac. Uses may include creating servers based written in Swift or writing programs that can be run without a user interface (think home automations and IoT). It is a great way to organize packages without using Pods or other third-party setups. When you build the code for production (or debugging) it will download and incorporate packages into the project.

Swift包管理器对于为Linux和Mac等平台编写Swift特别有用。用途可能包括创建基于Swift编写的服务器或编写可以在没有用户界面的情况下运行的程序(想想家庭自动化和物联网)。这是一种在不使用Pod或其他第三方设置的情况下组织包的好方法。当您为生产(或调试)构建代码时,它将下载并将包合并到项目中。

Note: This may change in the future, but is current as of Swift 3

注意:这可能在将来发生变化,但从Swift 3开始是最新的

#1


10  

It is not possible to use the Swift Package Manager in a playground at this time. The reason for that is that the Swift Package Manager is primarily used outside of apple platforms.

目前无法在游乐场中使用Swift Package Manager。原因是Swift Package Manager主要在Apple平台之外使用。

Apple mentions this on the Swift Package Manager's GitHub:

Apple在Swift Package Manager的GitHub上提到了这一点:

Note that at this time the Package Manager has no support for iOS, watchOS, or tvOS platforms

请注意,此时程序包管理器不支持iOS,watchOS或tvOS平台

The Swift Package Manager is especially useful for writing Swift for platforms such as Linux and Mac. Uses may include creating servers based written in Swift or writing programs that can be run without a user interface (think home automations and IoT). It is a great way to organize packages without using Pods or other third-party setups. When you build the code for production (or debugging) it will download and incorporate packages into the project.

Swift包管理器对于为Linux和Mac等平台编写Swift特别有用。用途可能包括创建基于Swift编写的服务器或编写可以在没有用户界面的情况下运行的程序(想想家庭自动化和物联网)。这是一种在不使用Pod或其他第三方设置的情况下组织包的好方法。当您为生产(或调试)构建代码时,它将下载并将包合并到项目中。

Note: This may change in the future, but is current as of Swift 3

注意:这可能在将来发生变化,但从Swift 3开始是最新的