4 ms·
One feature of Swift Playgrounds that really doesn't get as much attention as it deserves is the Swift Playground Book [1] subscription: > You create content f
by Kon-Peki 5y ago
One feature of Swift Playgrounds that really doesn't get as much attention as it deserves is the Swift Playground Book [1] subscription:
> You create content for the Swift Playgrounds app by writing playground books. Like traditional books, playground books are made up of chapters and pages. Unlike traditional books, they include executable Swift code that displays the results live, right on the page.
> Swift Playgrounds subscriptions, like podcasts, are a sequence of episodic content arranged in an order that builds knowledge while allowing more advanced learners to skip content. Subscriptions exist on the internet as feeds—downloadable lists of items that apps and websites can deal with. You publish a set of playgrounds as a feed that the Swift Playgrounds app can download, process, and display.
You publish them on your own website, via a JSON feed. No App Store review needed. You could treat it like a Jupyter Notebook, or an interactive story world - whatever you want.
[1] https://developer.apple.com/documentation/swift_playgrounds https://developer.apple.com/documentation/swift_playgrounds
- drusepth 5y agoThis sounds interesting! I didn't know browsers could execute Swift. Do you have any links to share of examples? (I don't see any examples in the documentation)
- andreasley 5y agoBrowsers can't execute Swift code. The books are loaded directly into the Swift Playgrounds app. As for links, there are very few subscriptions published – and probably none yet that work with Swift Playgrounds 4.0.
- nexuist 5y agoIt's not executed in-browser, it runs in the Swift Playgrounds app. Think of it like an RSS feed that you can add to the app, and it'll show you new chapters of the book once they're published.
- nikooellegaard 5y agoIf you're interested in it you can compile swift to wasm (webassembly) which can run in the browser natively https://swiftwasm.org/ https://swiftwasm.org/ This won't be it executing editable Swift like on the website and it'll require some binding to send and receive data to the website but it will indeed be swift being executed on the website
- elliekelly 5y agoThis is so fun! And you’re right, I had no idea even though I tinker around in playgrounds a bit. Thanks for sharing!
- AceJohnny2 5y ago"A Young Lady's Illustrated Primer", anybody? https://en.wikipedia.org/wiki/The_Diamond_Age https://en.wikipedia.org/wiki/The_Diamond_Age