Swiftpack.co - Package - SDGGiesbrecht/SDGSwift


macOS • Linux



SDGSwift enables use of the Swift compiler as a package dependency.

השֹּׁלֵחַ אִמְרָתוֹ אָרֶץ עַד־מְהֵרָה יָרוּץ דְּבָרוֹ׃
He sends His command to the earth; His word runs swiftly.

                                                                                                    ―a psalmist


  • Compiler operations such as building and testing: SDGSwift, SDGXcode
  • Package Manager operations such as fetching and manifest loading: SDGSwiftPackageManager
  • Utilities for defining configuration files written in Swift (similar to package manifests): SDGSwiftConfiguration, SDGSwiftConfigurationLoading

(For a list of related projects, see here.)


SDGSwift provides libraries for use with the Swift Package Manager.

Simply add SDGSwift as a dependency in Package.swift and specify which of the libraries to use:

let package = Package(
    name: "MyPackage",
    dependencies: [
        .package(url: "https://github.com/SDGGiesbrecht/SDGSwift", .upToNextMinor(from: Version(0, 10, 1))),
    targets: [
        .target(name: "MyTarget", dependencies: [
            .productItem(name: "SDGSwift", package: "SDGSwift"),
            .productItem(name: "SDGSwiftPackageManager", package: "SDGSwift"),
            .productItem(name: "SDGSwiftSource", package: "SDGSwift"),
            .productItem(name: "SDGXcode", package: "SDGSwift"),
            .productItem(name: "SDGSwiftConfiguration", package: "SDGSwift"),
            .productItem(name: "SDGSwiftConfigurationLoading", package: "SDGSwift"),
            .productItem(name: "SampleConfiguration", package: "SDGSwift"),

The libraries’ modules can then be imported in source files:

import SDGSwift
import SDGSwiftPackageManager
import SDGSwiftSource
import SDGXcode
import SDGSwiftConfiguration
import SDGSwiftConfigurationLoading
import SampleConfiguration

Example Usage

let package = Package(url: URL(string: "https://github.com/apple/example\u{2D}package\u{2D}dealer")!)
try package.build(.version(Version(2, 0, 0)), to: temporaryDirectory).get()


The SDGSwift project is maintained by Jeremy David Giesbrecht.

If SDGSwift saves you money, consider giving some of it as a donation.

If SDGSwift saves you time, consider devoting some of it to contributing back to the project.

Ἄξιος γὰρ ὁ ἐργάτης τοῦ μισθοῦ αὐτοῦ ἐστι.
For the worker is worthy of his wages.



Stars: 11
Help us keep the lights on



0.10.1 - May 22, 2019

Bug Fixes

  • Multi‐paragraph markdown quotations are parsed correctly.

0.10.0 - May 16, 2019

Breaking Changes

  • The products directory is no longer hard‐coded but instead queried from the package manager. Since releaseProductsDirectory() and related methods can now fail, their return values have been changed to Result.

New Features

  • The documentation of a package declaration can be retrieved directly without loading all the documentation of the entire module.

0.9.0 - May 9, 2019

Breaking Changes

  • Methods which throw specific errors types now do so using Result for stronger typing.
    • Affected initializers have been converted into static generator functions, because initializers cannot return a Result.
    • Related error types have been refactored.
  • Swift, Git and Xcode are searched for using which and similar commands. This makes it possible to control which installation gets used with tools like xcode-select or swiftenv. However, if an incompatible version is selected with such a tool, it may cause a parallel, compatible installation to be overlooked, even if it is in a standard location and was previously discoverable.

Bug Fixes

  • LinuxMain.swift is exempt from test coverage.

0.8.0 - Apr 26, 2019

Breaking Changes

  • Test coverage is now also available directly through the package manager in SDGSwiftPackageManager. Related data structures have been sunk down from SDGXcode into SDGSwiftPackageManager.
  • Several hard‐coded package repository properties have been moved from SDGSwift. Retrieve their dynamic values from SDGSwiftPackageManager instead:
    • .dataDirectory.packageWorkspace().dataPath.asURL
    • .editablesDirectory.packageWorkspace().editablesPath.asURL

0.7.1 - Apr 18, 2019

New Features

  • Compatible with Swift 5.0.1.
  • Compatible with Xcode 10.2.1.

Bug Fixes

  • Checks for build warnings correctly distinguish between those in the developer’s control and those belonging to dependency packages, ignoring the latter.
  • Xcode coverage reports containing invalid source positions do not cause crashes.