📲 Creating a Playground Book for iPad

Swift Playgrounds is a revolutionary app that makes possible to write Swift code on an iPad. Starting from Swift Playgrounds 3.x, the app has added a new feature: UserModules; it lets you include Swift code and make it available across multiple chapters, like modules.

nef takes advantage of these new possibilities, together with advancements in Swift Package Manager, to build a Playground Book with external dependencies from a Swift Package specification.

Given a Package.swift like the next one:

 // swift-tools-version:5.2

 import PackageDescription

 let package = Package(
     name: "BowProject",
     products: [
         .library(name: "BowTutorial", targets: ["nef"])
     ],
     dependencies: [
         .package(url: "https://github.com/bow-swift/bow.git", from: "0.8.0"),
     ],
     targets: [
         .target(name: "nef", dependencies: ["Bow"])
     ]
 )

You can run the following command:

 ➜ nef ipad --name PlaygroundName --package Package.swift --output ~/Desktop

It will create a Playground Book (named PlaygroundName) with support for the external dependencies, and save it in ~/Desktop

Options: