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

Versioning note: Most products are already “finalized” at a state comparable to a semantic version one (SDGSwift, SDGSwiftSource, SDGXcode, SDGSwiftConfiguration and SDGSwiftConfigurationLoading). The package as a whole remains zero‐versioned because SDGSwiftPackageManager still relies on hidden implementation details of the package manager.

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()


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, 19, 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 modules can then be imported in source files:

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


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: 20


Used By

Total: 0


Version 0.19.1 - 2020-01-15 22:15:36

Bug Fixes

  • Several access control issues have been resolved.

Version 0.19.0 - 2020-01-14 22:48:35

Breaking Changes

  • SyntaxScanner is now a protocol.
  • FunctionalSyntaxScanner is now a structure.

Bug Fixes

  • Syntax highlighting exposes the entire syntax tree to CSS.
  • PackageRepository.scheme() is better at identifying the proper package scheme when other schemes are available.
  • Test coverage boundaries reported Xcode have fewer differences from those reported by SwiftPM.

0.18.4 - 2019-12-11 20:50:10

Bug Fixes

  • Compatibility with Swift 5.1.3 and Xcode 11.3.

Version 0.18.3 - 2019-12-10 19:50:23

Bug Fixes

  • HTML entities in documentation are no longer escaped when rendered.

Version 0.18.2 - 2019-12-08 21:20:33

Bug Fixes

  • Xcode’s warning check has been improved to ignore more warnings caused by SwiftPM’s project generation.

Version 0.18.1 - 2019-12-06 04:38:06

New Features

  • PackageRepository instances can now checkout(_:) branches.

Version 0.18.0 - 2019-12-03 03:42:35

Breaking Changes

  • Many calls to Swift, Git and Xcode permit a wider version range according to the availability of the necessary APIs.
    • The custom subcommand methods and error types have been redesigned accordingly.
  • Functionality deprecated by Swift has been removed, such as test manifest generation and static linking of the Standard Library.
  • Derived data is no longer necessary for locating test coverage and related API has been removed.

Version 0.17.0 - 2019-11-15 03:22:04

Breaking Changes

  • Swift 5.1.1–5.1.2
  • Xcode 11.2–11.2.1

Bug Fixes

  • The search algorithm for manifest entry documentation tolerates of more formatting variations.
  • API scanning understands property wrappers.

Version 0.16.2 - 2019-11-02 22:40:56

New Features

  • Compatibility with up to Swift 5.1.2 and Xcode 11.2.

Version 0.16.1 - 2019-10-30 03:10:24

Bug Fixes

  • HTML entities remain intact when inspecting Markdown source nodes.
  • Several dropped core library symbols have been restored for inheritance.

Version 0.16.0 - 2019-10-27 04:14:22

Breaking Changes

  • Xcode 11.1
  • Version has been dropped. (It is now in SDGCornerstone’s SDGVersioning instead.)
  • SDGXcode supports raw packages without Xcode projects.
    • Xcode’s preferred location for derived data cannot be reliably determined for a package. Instead, a particular derived data location can be specified for building and testing. Test coverage checks that follow must query the same directory. stableDerivedData can be used for this purpose.
    • Error types and cases have been adjusted.
  • ExtendedTokenKind has a new case: sourceHeading.

New Features

  • Testing is done with automatic test detection, even on Linux.

Bug Fixes

  • Syntax highlighting colours have been updated.

Version 0.15.0 - 2019-10-22 05:00:23

Breaking Changes

  • Package loading methods have been refactored to defer more of the work to SwiftPM itself. The error types have changes and error messages are higher quality.
  • SyntaxParser.parse(_:) has been removed. Use SwiftSyntax’s own new equivalent: SwiftParser.parse(source:).

Bug Fixes

  • Fixed an issue where invalid UTF‐8 offsets received from CommonMark could lead to crashes. While rounding to valid offsets reduces the risk of a crash, the result may still be logically incorrect.
  • Several of Swift’s newer keywords are now directly supported.
  • Core library inheritance information has been updated to match Swift 5.1.

Version 0.14.1 - 2019-10-09 03:19:49

Bug Fixes

  • Compatible with Xcode 11.1 (in addition to Xcode 11.0).

Version 0.14.0 - 2019-10-05 02:54:28

Breaking Changes

  • ExtendedSyntax nodes have been adjusted according to Markdown parsing changes in the compiler.

New Features

  • All platform restrictions have been removed.

Version 0.13.1 - 2019-09-24 22:48:47

Bug Fixes

  • Configuration loading has been adjusted to reduce the chances of encountering SR‐11513.
  • Fixed a bug where Git’s ignoredFiles() missed files on some devices.

Version 0.13.0 - 2019-09-23 22:33:32

Breaking Changes

  • Swift 5.1
  • Xcode 11

New Features

  • SyntaxCollection methods isEmpty and first have been filled in to replace counterparts dropped by SwiftSyntax.

Version 0.12.7 - 2019-09-05 19:54:46

Bug Fixes

  • Fixed an issue where whitespaces in package names could cause Xcode operations to fail.

Version 0.12.6 - 2019-08-17 01:54:13

Bug Fixes

  • Dependency updates.

Version 0.12.5 - 2019-07-30 01:55:32

Bug Fixes

  • Interface‐related components are now localized into German.

Version 0.12.4 - 2019-07-23 01:14:45

Bug Fixes

  • Compatible with Xcode 10.3.

Version 0.12.3 - 2019-07-10 04:24:50

Bug Fixes

Dependency updates.

Version 0.12.2 - 2019-06-22 05:20:27

Bug Fixes

Dependency updates.

Version 0.12.1 - 2019-06-14 02:32:06

Bug Fixes

Dependency updates.

Version 0.12.0 - 2019-06-12 06:19:12

Versioning Note

Most products are now “finalized” at a state comparable to a semantic version one (SDGSwift, SDGSwiftSource, SDGSwiftConfiguration and SDGSwiftConfigurationLoading). The package as a whole remains zero‐versioned because SDGSwiftPackageManager and SDGXcode still rely on hidden implementation details of the package manager and Xcode respectively.

Breaking Changes

  • Modules do not export their dependencies. Each must be imported separately.

Version 0.11.0 - 2019-06-01 02:08:55

Breaking Changes

  • The documentation property of API elements is now a list of all documentation comments preceding the symbol. To get the one recognized by the Swift compiler (equivalent to the old behaviour), use documentation.last?.documentationComment.
  • releaseProductsDirectory() has been replaced with productsDirectory(releaseConfiguration:).

Version 0.10.1 - 2019-05-22 05:31:39

Bug Fixes

  • Multi‐paragraph markdown quotations are parsed correctly.

Version 0.10.0 - 2019-05-16 02:57:59

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.

Version 0.9.0 - 2019-05-09 03:34:53

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.

Version 0.8.0 - 2019-04-26 20:54:27

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

Version 0.7.1 - 2019-04-18 01:56:40

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.