轻松地从 Swift 脚本或命令行工具生成 Xcode 工作区和 Playground。
生成工作区
import Xgen
let workspace = Workspace(path: "~/MyWorkspace")
workspace.addProject(at: "~/MyProject.xcodeproj")
try workspace.generate()
生成 Playground
import Xgen
let code = "import Foundation\n\n" +
"print(\"Hello world\")"
let playground = Playground(path: "~/MyPlayground", platform: .iOS, code: code)
try playground.generate()
$ marathon add git@github.com:JohnSundell/Xgen.git 将 Xgen 添加到 Marathon。git@github.com:JohnSundell/Xgen.git 添加到您的 Marathonfile。$ marathon run yourScript.swift 运行它。.Package(url: "git@github.com:johnsundell/xgen.git", majorVersion: 1) 添加到您的 Package.swift 文件。$ swift package update 更新您的包。