Swiftpack.co - SDGGiesbrecht/SDGSwift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by SDGGiesbrecht.
SDGGiesbrecht/SDGSwift 13.0.1
The Swift Compiler As a Package
⭐️ 65
🕓 5 weeks ago
macOS linux windows android wasi
.package(url: "https://github.com/SDGGiesbrecht/SDGSwift.git", from: "13.0.1")

macOS • Windows • Web • Ubuntu • tvOS • iOS • Android • Amazon Linux • watchOS

Documentation

SDGSwift

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

השֹּׁלֵחַ אִמְרָתוֹ אָרֶץ עַד־מְהֵרָה יָרוּץ דְּבָרוֹ׃

He sends His command to the earth; His word runs swiftly.

―a psalmist

Features

  • 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

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

Some platforms lack certain features. The compilation conditions which appear throughout the documentation are defined as follows:

.define("PLATFORM_LACKS_FOUNDATION_FILE_MANAGER", .when(platforms: [.wasi])),
.define("PLATFORM_LACKS_FOUNDATION_PROCESS", .when(platforms: [.wasi, .tvOS, .iOS, .watchOS])),
.define(
  "PLATFORM_NOT_SUPPORTED_BY_SWIFT_MARKDOWN",  // @exempt(from: marks)
  .when(platforms: [.wasi])
),
.define(
  "PLATFORM_NOT_SUPPORTED_BY_SWIFT_PM",
  .when(platforms: [.windows, .wasi, .tvOS, .iOS, .android, .watchOS])
),
.define(
  "PLATFORM_NOT_SUPPORTED_BY_SWIFT_SYNTAX",
  .when(platforms: [.wasi, .tvOS, .iOS, .android, .watchOS])
),
.define(
  "PLATFORM_NOT_SUPPORTED_BY_SWIFT_SYNTAX_PARSER",
  .when(platforms: [.windows, .wasi, .tvOS, .iOS, .android, .watchOS])
),

Importing

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(
      name: "SDGSwift",
      url: "https://github.com/SDGGiesbrecht/SDGSwift",
      from: Version(13, 0, 1)
    ),
  ],
  targets: [
    .target(
      name: "MyTarget",
      dependencies: [
        .product(name: "SDGSwift", package: "SDGSwift"),
        .product(name: "SDGSwiftPackageManager", package: "SDGSwift"),
        .product(name: "SDGSwiftSource", package: "SDGSwift"),
        .product(name: "SDGSwiftDocumentation", package: "SDGSwift"),
        .product(name: "SDGXcode", package: "SDGSwift"),
        .product(name: "SDGSwiftConfiguration", package: "SDGSwift"),
        .product(name: "SDGSwiftConfigurationLoading", package: "SDGSwift"),
        .product(name: "SampleConfiguration", package: "SDGSwift"),
      ]
    )
  ]
)

The modules can then be imported in source files:

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

About

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.

―‎ישוע/Yeshuʼa

GitHub

link
Stars: 65
Last commit: 8 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Version 13.0.1
5 weeks ago

Bug Fixes

  • Test coverage loading works with Swift 5.8.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics