4

I am using Xcode Playgrounds to make tutorials about Swift. I was wondering, can I put multiple playground files into one Xcode workbook? I want one workbook with multiple playground tutorials in it.

1
  • 1
    You can add multiple source files in a playground yes, not sure about workbook?
    – Scriptable
    Sep 11, 2018 at 12:31

2 Answers 2

16

You can right click on your top level file and select the "New Playground Page" button, which will give you a separate page.

new page

The below image shows the new page created after you click that button. "Untitled Page" is the initial page, and "Untitled Page 2" is the new page.

new page

1
  • Thanks for the help, That works! Ok, now I would like to make links to topics within my playgrounds. So instead of going [Next] (@next) which brings me to the next page, can I do the same but send me to a topic within that same page? Basically, I want to go back to a class and add code for additional properties or functions. Say, that I am further along in the tutorial and want to quickly link back to the top... Sep 13, 2018 at 1:50
3

You can create either Empty Project or Workspace to manage your multiple playground files under one roof.

1. Empty Project:

  • File -> New -> Project
  • Choose Other and Select Empty

enter image description here

  • Create/Add Your Playground files to the workspace by right clicking on the Project Navigator

enter image description here

2. Workspace:

  • File -> New -> Workspace

New Workspace Option

  • Create/Add Your Playground files to the workspace by right clicking on the Project Navigator

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.