Open ashfurrow opened 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.
Maybe editing the playground workspace xml manually could be used?
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.
Cool! I tried symlinks and macOS shortcuts without success.
See the discussion on https://github.com/ashfurrow/playgroundbook/pull/34
The .playgroundbook
format has 3 different Source
folders:
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
.
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.