Swiftpack.co - Package - SDGGiesbrecht/SDGInterface

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.


Tools for Implementing a Graphical User Interface

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



SDGInterface provides tools for implementing a graphical user interface.

Καὶ ὁ Λόγος σὰρξ ἐγένετο καὶ ἐσκήνωσεν ἐν ἡμῖν, καὶ ἐθεασάμεθα τὴν δόξαν αὐτοῦ, δόξαν ὡς μονογενοῦς παρὰ πατρός, πλήρης χάριτος καὶ ἀληθείας.

And the Word became flesh and dwelt among us and we have watched His glory, the glory of the Only Begotten of the Father, full of grace and truth.



  • API unification accross platforms.
  • Localized menu bar.

Example Usage

import Foundation

import SDGText
import SDGLocalization

import SDGInterface
import SDGApplication

public struct SampleApplication: SDGApplication.Application {

  public init() {}

  public var applicationName: ProcessInfo.ApplicationNameResolver {
    return { form in
      switch form {
      case .english(let region):
        switch region {
        case .unitedKingdom, .unitedStates, .canada:
          return "Sample"
      case .español(let preposición):
        switch preposición {
        case .ninguna:
          return "Ejemplar"
        case .de:
          return "del Ejemplar"
      case .deutsch(let fall):
        switch fall {
        case .nominativ, .akkusativ, .dativ:
          return "Beispiel"
      case .français(let préposition):
        switch préposition {
        case .aucune:
          return "Exemple"
        case .de:
          return "de l’Exemple"

      case .ελληνικά(let πτώση):
        switch πτώση {
        case .ονομαστική:
          return "Παράδειγμα"
        case .αιτιατική:
          return "το Παράδειγμα"
        case .γενική:
          return "του Παραδείγματος"
      case .עברית:
        return "דוגמה"

  public var applicationIdentifier: String {
    return "com.example.SampleApplication"

  public func finishLaunching(_ details: LaunchDetails) -> Bool {
    Swift.print("Hello, world!")
    return true
@main extension SampleApplication {}


SDGInterface provides libraries for use with the Swift Package Manager.

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

let package = Package(
  name: "MyPackage",
  dependencies: [
      name: "SDGInterface",
      url: "https://github.com/SDGGiesbrecht/SDGInterface",
      .upToNextMinor(from: Version(0, 10, 0))
  targets: [
      name: "MyTarget",
      dependencies: [
        .product(name: "SDGApplication", package: "SDGInterface"),
        .product(name: "SDGInterface", package: "SDGInterface"),
        .product(name: "SDGInterfaceTestUtilities", package: "SDGInterface"),
        .product(name: "SDGMenuBar", package: "SDGInterface"),
        .product(name: "SDGErrorMessages", package: "SDGInterface"),
        .product(name: "SDGProgressIndicators", package: "SDGInterface"),
        .product(name: "SDGKeyboard", package: "SDGInterface"),

The modules can then be imported in source files:

import SDGApplication
import SDGInterface
import SDGInterfaceTestUtilities
import SDGMenuBar
import SDGErrorMessages
import SDGProgressIndicators
import SDGKeyboard


The SDGInterface project is maintained by Jeremy David Giesbrecht.

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

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

Ἄξιος γὰρ ὁ ἐργάτης τοῦ μισθοῦ αὐτοῦ ἐστι.

For the worker is worthy of his wages.



Stars: 3
Last commit: 13 hours ago


Version 0.10.0 - 2021-02-17T06:58:37

Breaking Changes

  • The SDGInterfaceBasics, SDGTables and SDGViews modules have been combined into a single SDGInterface module.

  • More types have been converted to a SwiftUI‐style API:

    • Application
    • SystemMediatorSystemInterface
  • Label can now be bound to dynamic values.

    • CompatibilityLabel is now distinct from Label.
  • Application is compatible with @main.

  • Binding is obsolete and has been removed.

  • Rich text case transformations now apply proper font features instead of swapping glyphs (but may now be ignored by fonts that don’t support them, just like fonts can ignore bold or italics).

New Features

  • Window can be used as a SwiftUI.Scene.
  • Views composed entirely of other views can conform to CompositionViewImplementation to get default implementations for all the View protocol requirements.
  • TextField has an onCommit action.
  • Less of the API is disabled on the web platform (because parts of Foundation are now available).

Bug Fixes

  • The API has been updated to use #filePath.