Playground books are document based app with a file and folder specific structure. The playground book file structure is similar to a regular book's structure.
To put it simply: the Playground book holds chapters, and those chapters hold pages and that's where you'll be writing your code to create your Playground book.
For each level in this book structure, there is a specific extension to accompany it:
• The book folder has a .playgroundbook extension. It is the top-level folder for the playgroundbook.
• The chapters folder has a .playgroundchapter extension.
• The pages folder has a .playgroundpage extension.
And for each book level, you'll need a manifest.plist file.
Below you'll see the File Hierarchy. This illustrates the file structure of how files and folders for the playground book package should be formatted.
The Sources folder is where you'll put your global Swift files that you'd want to compile and make available to every page. You don't have to import anything to make this work. Anything that's declared as a public source will be ready as soon as you open your playground page.
The Chapter folder is what you probably expected. It's the folder that holds all of the chapters in the playground book which also contain one or more playground pages. Each page within the folder contains the content you'll interact with when the playground book app is used.
Manifest files are property lists, dictionaries of keys and values that Swift Playgrounds uses to determine how pages with documents are supposed to behave. The manifest.plist provides information such as the location of icons being used in a document, the documents development targets, and list of chapters in the playground book or just the name of the page .
The manifest.plist file also stores:
Metadata such as book version and book target platform
Order of chapters
User-viewable name for the book
As you can see in the image above, a manifest file is located in the Contents folder inside the top-level playground book folder and also at every book level.
There are three major files in a Playground page folder. There's the manifest.plist, LiveView.swift file, and the Contents.swift file. Next, we're going to take a look at the Contents.swift file.