Search code examples
swiftswift-playgroundswift-package-manager

How to use Swift Package Manager in Xcode 9 Playground


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


Solution

  • 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.

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

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

    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.

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