playgroundbooks / playgroundbook

Tool for Swift Playground books
https://ashfurrow.com/blog/swift-playground-books/
MIT License
260 stars 17 forks source link

Add support for shared code between chapters #17

Open ashfurrow opened 8 years ago

ashfurrow commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

Maybe editing the playground workspace xml manually could be used?

rhysforyou commented 8 years ago

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 commented 8 years ago

Cool! I tried symlinks and macOS shortcuts without success.

dionlarson commented 8 years ago

See the discussion on https://github.com/ashfurrow/playgroundbook/pull/34

The .playgroundbook format has 3 different Source folders:

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