Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for shared code between chapters #17

Open
ashfurrow opened this issue Aug 28, 2016 · 5 comments
Open

Add support for shared code between chapters #17

ashfurrow opened this issue Aug 28, 2016 · 5 comments

Comments

@ashfurrow
Copy link
Member

It's as easy as copying Swift files into the Sources folder, we would need to document how playgrounds on the mac need to reference these and not copy them.

@ashfurrow
Copy link
Member Author

This is really tricky, since Playgrounds on macOS will only copy files and not reference them from outside the playground. It may just be a matter of having to duplicate the code across chapters. Not ideal, but might be good enough. Since I haven't had a need to references files across chapters yet, I can't prioritize/figure out the best solution for this issue.

@ashfurrow
Copy link
Member Author

Maybe editing the playground workspace xml manually could be used?

@rhysforyou
Copy link
Contributor

I have a playground book I want to try building over the next week or so that's going to rely on some shared code stuff, so I'll hopefully get a better sense of that stuff.

@ashfurrow
Copy link
Member Author

Cool! I tried symlinks and macOS shortcuts without success.

@dionlarson
Copy link
Collaborator

See the discussion on #34

The .playgroundbook format has 3 different Source folders:

  • Root Source folder shared by every chapter
  • .playgroundchapter/Source folder (similar to .playground/Source)
  • .playgroundpage/Source folder (similar to .xcplaygroundpage/Source)

That said, I have not found a way to use the same file in multiple .playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants