Swift Package Index

SDGInterface

https://github.com/sdggiesbrecht/sdginterface.git

Tools for Implementing a Graphical User Interface


Compatibility

  • 0.10.0 and master
    5.3
    5.2
    5.1
    5.0
    4.2
  • 0.10.0 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS

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

Documentation

SDGInterface

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.

―‎יוחנן⁩/Yoẖanan

Features

  • 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 {}

Importing

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: [
    .package(
      name: "SDGInterface",
      url: "https://github.com/SDGGiesbrecht/SDGInterface",
      .upToNextMinor(from: Version(0, 10, 0))
    ),
  ],
  targets: [
    .target(
      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

About

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.

―‎ישוע/Yeshuʼa