Swiftpack.co - Package - JohnSundell/Xgen


Easily generate Xcode workspaces & playgrounds from a Swift script or command line tool.


Generate workspaces:

import Xgen

let workspace = Workspace(path: "~/MyWorkspace")
workspace.addProject(at: "~/MyProject.xcodeproj")
try workspace.generate()

Generate playgrounds:

import Xgen

let code = "import Foundation\n\n" +
           "print(\"Hello world\")"
let playground = Playground(path: "~/MyPlayground", platform: .iOS, code: code)
try playground.generate()


For scripts

  • Install Marathon.
  • Add Xgen to Marathon using $ marathon add git@github.com:JohnSundell/Xgen.git.
  • Alternatively, add git@github.com:JohnSundell/Xgen.git to your Marathonfile.
  • Write your script, then run it using $ marathon run yourScript.swift.

For command line tools

  • Add .Package(url: "git@github.com:johnsundell/xgen.git", majorVersion: 1) to your Package.swift file.
  • Update your packages using $ swift package update.

Help, feedback or suggestions?

  • Open an issue if you need help, if you found a bug, or if you want to discuss a feature request.
  • Open a PR if you want to make some change to Xgen.
  • Contact @johnsundell on Twitter for discussions, news & announcements about Xgen & other projects.


Stars: 158
Help us keep the lights on


2.2.0 - Dec 17, 2018

This release makes it possible to add auxiliary source files to a playground generated with Xgen.

2.1.0 - Apr 28, 2018

Added the option to disable auto running a generated playground.

2.0.1 - Nov 5, 2017

Xgen now uses Files 2.0 and ShellOut as a test-only dependency.

2.0.0 - Oct 26, 2017

Xgen now uses Swift 4

1.0.1 - May 15, 2017

Xgen now uses HTTPS to clone its dependencies.