[SOLVED] How to import Swift Package in Playground?


Can i import Swift Package to my Playground that is in my workspace? I’ve already read the answer, but i think it’s outdated, because now we can use Swift Packages in iOS projects.


In Xcode 12, you can use Swift Packages with Xcode Playgrounds.

  • Open Xcode
  • Create a new Workspace (File > New > Workspace...)
  • Add the desired Swift package via File > Add Files to "Workspace Name"... selecting the package directory.
  • Create a new Playground via File > New > Playground.... Ensure that you select the Workspace we just created as the "Add to" and "Group" option during Playground creation (in the assistant where you select the Playground’s location on disk).
  • You can now import the Package target into your Playground and starting exploring the Package’s functionality.

You can find additional details and a sample project in this WWDC20 session: Explore Packages and Projects with Xcode Playgrounds

Ensure to check the new "Build active scheme" checkbox in the inspector for your existing Playgrounds.

Answered By – wolfrevo

Answer Checked By – Robin (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *