Playgrounds and frameworks

Has anyone found a reliable way to use a custom framework they're building within a playground? I've found two or three different methods via Google (adding playground to framework project, adding both framework project and playground to a workspace, etc.) but I haven't got any of them to work so far: I always get a "can't find module" error when I try to import the framework into the playground.


For the time being, I'll try building a test project, and drag my framework in there every time I make a change.

Replies

Same problem here, trying to import StarIO framework which is a 3rd party framework to which I do not have the sources so cannot build it per all the instructions I have found. Would even try adding the framework to Xcode contents if I could figure out where playgrounds look for built in frameworks.

Xcode 12 supports using frameworks in your project with Xcode Playgrounds. Ensure to check the new "Build active scheme" checkbox in the inspector for your existing Playgrounds.

As long as the active scheme builds your framework, you can import and use it from your Playground without further steps.

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