I had code that I wanted to treat as a library and import it into my Swift Playground. It took several hours of searching and experimenting until I came up with a recipe that worked. There may be easier, better ways to do this, but this is what worked for me on Xcode 6.1:
- Create a workspace.
- Add a new Cocoa Framework project to the workspace.
- Add a Swift file to the framework project.
- Remove Foundation.h file from the framework.
- Build the framework.
- Add a playground to the project (not the workspace).
- In the playground, add code to import the framework.
Now you can use your imported framework/library in the playground. Just add the library code to the framework (using the file in step 3 and adding other files as needed) and build the project. You can then access the public members in the framework.