Guides and Sample Code

Developer

Playground Book Format Reference

On This Page

Book Manifest

The Manifest.plist file for a book contains the following key-value pairs specifying the attributes for a book:

  • Metadata such as book version and book target platform

  • Order of chapters

  • User-viewable name for the book

The file is located in the Contents folder inside the top-level .playgroundbook folder.

Key List

Table 2-1 describes each key for a book, its type, and whether the key is required.

Table 2-1Keys for a book

Key

Type

Description

Required

Chapters

Array of strings

The list of chapters in the book, in the order in which they appear in the table of contents. See Chapters Key.

ContentIdentifier

String

The bundle ID, a unique identifier string for the book in reverse DNS format. See ContentIdentifier Key.

ContentVersion

String

A developer-defined version number for the book. See ContentVersion Key.

DeploymentTarget

String

The minimum version of iOS required for the book. See DeploymentTarget Key.

ImageReference

String

The name of the image used for the book icon in Swift Playgrounds. See ImageReference Key.

 

Name

String

The name displayed in the user interface. See Name Key.

Version

String

The playground book format version. See Version Key.

SwiftVersion

String

The version of Swift that the playground book uses. See SwiftVersion Key.

MinimumSwiftPlaygroundsVersion

String

The minimum version of Swift Playgrounds that is required for using the book. See MinimumSwiftPlaygroundsVersion Key.

Chapters Key

An array of the .playgroundchapter folders used for the chapters in a book. Each entry in the array contains the name and extension of a folder in the Chapters folder of the book package. The table of contents for the playground book displays only the chapters listed in this array. The order of the items in the Chapters array defines the order of the chapters in the book.

Figure 2-1 shows a table of contents with two chapters. The name of each chapter is taken from the value of the Name key in the chapter manifest file.

Figure 2-1Chapters in the table of contents image: ../Art/SP_manifest_book_Chapters_TOC_2x.png

ContentIdentifier Key

A unique identifier for the book package. The recommended format is a reverse DNS string starting with your company or personal identifier followed by a name for the book.

ContentVersion Key

The content developer's version number for the book. The value contains only numbers and periods (.).

DeploymentTarget Key

The minimum version of iOS that can use your playground book. The format of the string is:

  • iosmajor-version.minor-version

The version number must be at least 10.0.

ImageReference Key

A reference to an image used for the book icon. The image is a .png file in the book’s Resources folder. The icon must be an image with a 4:3 aspect ratio. The recommended image size is 400 by 300 pixels.

Figure 2-2 shows a custom image used for the book icon.

Figure 2-2Custom book icon image: ../Art/SP_manifest_book_ImageReference_icon_2x.png

Name Key

The display name of the book in the user interface; for example, the name of the book in the table of contents.

Version Key

The version of the playground book format. Use 3.0.

SwiftVersion Key

The version of Swift that the playground book uses. If unspecified, 3.1 is used.

MinimumSwiftPlaygroundsVersion Key

The minimum version of the Swift Playgrounds app that the playground book uses. If unspecified, 1.2 is used.