All Projects → playgroundbooks → Playgroundbook

playgroundbooks / Playgroundbook

Licence: mit
Tool for Swift Playground books

Programming Languages

ruby
36898 projects - #4 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to Playgroundbook

Audiokit
Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS
Stars: ✭ 8,827 (+3334.63%)
Mutual labels:  playground, swift-playgrounds
Awesome Swift Playgrounds
A List of Awesome Swift Playgrounds
Stars: ✭ 3,521 (+1270.04%)
Mutual labels:  playground, swift-playgrounds
Julia Set Playground
A Swift playground that generates beautiful Julia set fractal images.
Stars: ✭ 236 (-8.17%)
Mutual labels:  playground, swift-playgrounds
Playground
Instantly create Swift playgrounds from the command line
Stars: ✭ 391 (+52.14%)
Mutual labels:  playground, swift-playgrounds
Swift Playgrounds
Learning Swift by working through example code in playgrounds
Stars: ✭ 199 (-22.57%)
Mutual labels:  playground, swift-playgrounds
Playgrounds
Better playgrounds that work both for Objective-C and Swift
Stars: ✭ 2,586 (+906.23%)
Mutual labels:  playground, swift-playgrounds
jscore-playground
JavaScriptCore example for Swift Playgrounds
Stars: ✭ 17 (-93.39%)
Mutual labels:  playground, swift-playgrounds
mnist-coreml
Simple convolutional neural network to predict handwritten digits using Keras + CoreML for WWDC '18 scholarship [Accepted]
Stars: ✭ 45 (-82.49%)
Mutual labels:  playground
ClassifierKit
🤖 A suite of tools and examples for training Core ML models with Create ML.
Stars: ✭ 23 (-91.05%)
Mutual labels:  swift-playgrounds
Paperville
🏙 Design a city in Swift code (WWDC 2018 submission, ACCEPTED)
Stars: ✭ 48 (-81.32%)
Mutual labels:  playground
tokonoma
Graphics related projects/prototypes/playground (Vulkan, C++17)
Stars: ✭ 23 (-91.05%)
Mutual labels:  playground
playground
Locally hosted Go playground for more advanced functionality.
Stars: ✭ 15 (-94.16%)
Mutual labels:  playground
swift-algorithms-data-structs
📒 Algorithms and Data Structures in Swift. The used approach attempts to fully utilize the Swift Standard Library and Protocol-Oriented paradigm.
Stars: ✭ 42 (-83.66%)
Mutual labels:  playground
substrate-playground
Start hacking your substrate runtime in a web based VSCode like IDE
Stars: ✭ 68 (-73.54%)
Mutual labels:  playground
UsingPlayground
👶 Demo how to use Playground
Stars: ✭ 25 (-90.27%)
Mutual labels:  playground
To-The-Apples-Core
⚙️ A collection of non-jailbroken code snippets on reverse-engineered iOS private apis
Stars: ✭ 69 (-73.15%)
Mutual labels:  playground
observable-playground
Know your Observables before deploying to production
Stars: ✭ 96 (-62.65%)
Mutual labels:  playground
tutorial
Tutorials for GoPlus (The Go+ Language)
Stars: ✭ 27 (-89.49%)
Mutual labels:  playground
tsquery-playground
Playground for TSQuery
Stars: ✭ 30 (-88.33%)
Mutual labels:  playground
vue-playground
Web Playground for Vue.js
Stars: ✭ 12 (-95.33%)
Mutual labels:  playground

CircleCI

playgroundbook

A series of tools for Swift Playground and Playground books based on Apple's documentation.

It's a work in progress (see issues) but you can use it now.

Installation

> [sudo] gem install playgroundbook

Usage

To lint an existing playground book:

> playgroundbook lint MyPlaygroundbook.playgroundbook

To generate a playground book:

> playgroundbook render book.yaml

The yml file should be in the following format:

name: Testing book
identifier: com.ashfurrow.example
resources: assets # Optional
cover: cover.jpeg # Optional
deployment_target: ios10.0 # Optional
imports: # Optional, defaults to UIKit
 - UIKit
 - CoreGraphics
chapters:
  - name: Chapter 1
    edge_to_edge_live_view: false # defaults to true
    live_view_mode: "VisibleByDefault" # defaults to "HiddenByDefault"
  - name: Chapter 2
  - etc...
glossary:
  term: definition

Note that you can't use tabs when indenting in the .yaml file. Everything needs to have spaces in order to work properly. Otherwise you will end up with parse errors.

Each chapter needs to have a corresponding playground; so Chapter 1 requires there be a Chapter 1.playground playground. Your directory should look like this:

Once you've created a playground for each chapter, it's time to add pages to your playgrounds. You can do this in Xcode.

Note that the order of the pages is determined by the ordering of the filesystem, which is lexicographical. You also can't have any periods in your pages.

Then run the render command in the directory containing the yaml file.

playgroundbook render book.yaml

The playgrounds can reference (not copy) resources from an optionally specified directory. import frameworks are specified in the yaml file and are added to every page of the book. You can specify a cover image file name that's stored in the resources directory (it should be 400x300 pixels). Finally, you can supply a glossary, a dictionary of term/definition pairs. This lets you link to terms in markdown. For example:

... [term](glossary://term) ...

Only the link to the term must be URL encoded. For example, the term "reuse identifier" would be defined in the yaml as reuse identifier but linked to as glossary://reuse%20identifier.

Each page in a chapter's .playground will be a separate page in the .playgroundbook and it's Source. The contents of the Source and Resource folders for each chapter and each page are copied.

Limitations of Book Rendering

Playground books support a rich set of awesome features to make learning how to code really easy, and this tool only scratches the surface. Read over the Playground Book reference to see all the available options. If you have suggestions, please open an issue 👍

Creating a Playground from markdown

Maybe you want to do something for a website, or a git repo first, and then generate your Playground? Well in those cases your source of truth is the markdown document. For that case, we have playgroundbook wrapper.

For example, you might have a folder that looks like:

> tree Beginners/Lesson\ One

Beginners/Lesson\ One
├── README.md
├── README_ZH.md
└── img
    ├── emptyplayground.png
    ├── multipleresults.png
    ├── newplayground.png
    ├── results.png
    ├── tentimes.png
    └── welcome.png

You can run:

playgroundbook wrapper "Beginners/Lesson\ One/README.md" "Lesson One"

And it will switch out swift codeblocks into the playground. You have to use triple backticks with swift ```swift. No space between them. You should avoid using backtick blocks for anything other than Swift code, if you need to show examples, use Markdown's indentation rules with four spaces.

> tree Beginners/Lesson\ One

Beginners/Lesson\ One
├── Lesson\ One.playground
│   ├── Contents.swift
│   ├── Resources
│   │   └── img
│   │       ├── emptyplayground.png
│   │       ├── newplayground.png
│   │       ├── results.png
│   │       └── welcome.png
│   ├── contents.xcplayground
│   └── timeline.xctimeline
├── README.md
...

You might notice that a subset of images, have moved well, they're the only one being used in the README.md. Slick huh?

Contributing

Hey! Like this tool? Awesome! We could actually really use your help!

Open source isn't just writing code. We could use your help with any of the following:

  • Finding (and reporting!) bugs.
  • New feature suggestions.
  • Answering questions on issues.
  • Reviewing pull requests.
  • Helping to manage issue priorities.
  • Fixing bugs/new features.

If any of that sounds cool to you, send a pull request! After a few contributions, we'll add you as an admin to the repo so you can merge pull requests and help steer the ship 🚢 You can read more details about that in our contributor guidelines.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by [its terms](Code of Conduct.md).

License

MIT, except for the starter.playgroundbook in the unit tests, which is licensed by Apple.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].