Original Title: 合理安排作品结构 Author: 黄赓 (Geng Huang, WWDC 17/18 Scholarship Winner) Recording (Mandarin): https://b23.tv/BV1KK4y1n7Gz
If we right click on a .playgroundbook
file and Show Package Contents, we'll see:
Playground Book Folder Structure
Chapters
Pages
Code (main.swift + LiveView.swift)
Page Resources + Manifest.plist
...
Chapter Resources + Manifest.plist
... Modules (Shared Source Code) Book Resources + Manifest.plist
Chapters
Pages
Description
Coding Area
Auto Complete Suggestions
Live View
<aside> 💡 Get the author template from the Tools and Document/Resources section in Authoring Swift Playground Books, or visit the official website:
</aside>
BookCore
module: implement every functionality possible of your playground book
UserModule
module: editable by users (probably not for WWDC), see example.
Manifest.plist
: check specification for book, chapter, and page
DevelopmentRegion
: should be in English so value should be en
DeploymentTarget
: no need to support earlier platforms because Apple will use latest to judge
BuildSettings.xcconfig
: change output book name and stuff
Check the included README.md
file for more instructions
Compile the PlaygroundBook
target and compile, you'll see the PlaygroundBook.playground
(or whatever name you specified) in the Products
folder. Right click and Open in Finder to get the book.
Add a new page: copy an existing page folder in Pages, paste and rename, then change Chapter Manifest to keep track of the new page. Similarly, to add a new chapter, copy-paste-modify, then change Book Manifest to add the new chapter.
Add resources (storyboard, music, images) to PrivateResources
folder.
Introduce the concepts in the first page, then gradually increase the difficulties in each page.