Sorting Playground Pages
If you keep a lot of playgrounds on hand in a single file (I do!), you may find it handy to sort your pages alphabetically. Use Edit > Sort > By Name to clean up your organization.
Hopefully you’ve named each page logically, for quicker scanning.
Unfortunately, as you add pages to playgrounds, Xcode performance takes a massive hit. While you can re-order by dragging, that starts to become impractical once you hit a couple of dozen playgrounds.
Copying Playground Pages
It can be simpler just to drag copies of a page into a new workspace with better performance. This screenshot shows dragging the “adding arrays” page over to a new playground file.
You can also open a playground package (Control-Click/Right-Click > Show Package Contents) and access individual source files however you like.
You cannot drag and drop these between packages unless you’re willing to start editing the contents.xcplayground XML. It’s not difficult, but it’s generally not worth your time.
Instead, consider opening the page in a text editor, and using copy/paste into a new page you manually add to another playground.
Searching Playgrounds
Xcode offers two search fields to help you locate material. The bottom search bar matches page names:
The search at the top of the navigator finds matching text.
Searching Playgrounds from the Command Line
A while back, I wrote pggrep to find playground files, which were not otherwise indexed by spotlight. Given how much material ends up in playground testbeds, pggrep has been a valuable tool for finding where I had explored some topic or another in the past.
Book
There’s also a book on all things Playground.
Comments are closed.