Swiftpack.co - Package - SDGGiesbrecht/SDGInterface

macOS • Windows • Web • Linux • tvOS • iOS • Android • 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 SDGApplication

internal class SystemMediator: SDGApplication.SystemMediator {

  internal func finishLaunching(_ details: LaunchDetails) -> Bool {
    Application.setSamplesUp()
    return true
  }
}
Application.main(mediator: SystemMediator())

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(url: "https://github.com/SDGGiesbrecht/SDGInterface", .upToNextMinor(from: Version(0, 7, 0))),
    ],
    targets: [
        .target(name: "MyTarget", dependencies: [
            .productItem(name: "SDGApplication", package: "SDGInterface"),
            .productItem(name: "SDGMenuBar", package: "SDGInterface"),
            .productItem(name: "SDGContextMenu", package: "SDGInterface"),
            .productItem(name: "SDGErrorMessages", package: "SDGInterface"),
            .productItem(name: "SDGMenus", package: "SDGInterface"),
            .productItem(name: "SDGPopOvers", package: "SDGInterface"),
            .productItem(name: "SDGWindows", package: "SDGInterface"),
            .productItem(name: "SDGTables", package: "SDGInterface"),
            .productItem(name: "SDGProgressIndicators", package: "SDGInterface"),
            .productItem(name: "SDGButtons", package: "SDGInterface"),
            .productItem(name: "SDGImageDisplay", package: "SDGInterface"),
            .productItem(name: "SDGTextDisplay", package: "SDGInterface"),
            .productItem(name: "SDGViews", package: "SDGInterface"),
            .productItem(name: "SDGKeyboard", package: "SDGInterface"),
            .productItem(name: "SDGInterfaceBasics", package: "SDGInterface"),
        ])
    ]
)

The modules can then be imported in source files:

import SDGApplication
import SDGMenuBar
import SDGContextMenu
import SDGErrorMessages
import SDGMenus
import SDGPopOvers
import SDGWindows
import SDGTables
import SDGProgressIndicators
import SDGButtons
import SDGImageDisplay
import SDGTextDisplay
import SDGViews
import SDGKeyboard
import SDGInterfaceBasics

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

Github

link
Stars: 2

Dependencies

Used By

Total: 0

Releases

Version 0.7.0 - 2020-03-27 05:36:02

Breaking Changes

  • To make View generic and improve SwiftUI performance, it has been split in two, with LegacyView covering the functionality available without SwiftUI.
    • Existential uses that could not be made generic now use the new AnyView wrapper.
    • Properties have been converted to methods to make it clearer that the representation is constructed on demand, not stored.
      • swiftUIViewswiftUI()
      • cocoaViewcocoa()
  • CocoaView is now used in many places to bridge the differences between NSView and UIView.
  • Functionality of AnyCocoaView has been moved to CocoaView.
    • Layout constraint APIs have been updated.
  • Spacing has been removed in favour of Double?. .automatic is replaced by nil.
  • StabilizedView has been removed as it is no longer meaningful. (CocoaView is stable, and is the type used in the API of methods that require stability.)
  • letterboxed(aspectRatio:background:) has been renamed to letterbox(aspectRation:background).

New Features

  • Web is now supported (as a platform). Actual runtime stability depends on the toolchain used to compile the package.

Bug Fixes

  • EmptyView is available back to watchOS 6.

Version 0.6.0 - 2020-02-19 04:52:01

Breaking Changes

  • A View is no longer assumed to be a Cocoa view in need of a SwiftUI wrapper. Such views should now declare a conformance to CocoaViewImplementation to get the default wrapper.
  • SwiftUIView has been removed. SwiftUI views no longer need to be wrapped; they should conform to View directly. This is as simple as declaring a conformance to SwiftUIViewImplementation.
  • To align with View.cocoaView,
    • SpecificView.specificNative has been renamed to .specificCocoaView.
    • AnyNativeView has been renamed to AnyCocoaView.
  • Many protocols—most notably View—no longer inherit from AnyObject, so that structures can be used.
  • Parts of the API have shifted to a style more like SwiftUI and less like Cocoa.
    • lockAspectRatio(to:)aspectRatio(_:contentMode:)
    • Letterboxletterboxed(aspectRatio:background:)
    • MarginViewpadding(_:_:)
    • RowViewHorizontalStack

New Features

  • Windows and Android have support comparable to Linux. Actual runtime stability depends on the toolchain used to compile the package.
  • Several of the view‐related protocols are now available on watchOS.

Version 0.5.0 - 2019-12-01 23:00:07

Breaking Changes

  • View.native has been renamed to View.cocoaView to contrast against swiftUIView.
  • Font.resized(to:) has been dropped. It has been sunk into SDGCornerstone’s SDGText instead.

New Features

  • SwiftUI‐related features are available on iOS.
  • All views can be incorporated into SwiftUI hierarchies via their swiftUIView property.

Version 0.4.0 - 2019-10-25 20:46:30

Breaking Changes

  • Swift 5.1
  • alignFirstBaselines(ofSubviews:) has been removed in favour of alignLastBaselines(ofSubviews:) for compatibility with older platforms.

New Features

  • All platform restrictions have been dropped.
  • Wrappers are available for incorporating SwiftUI into View hierarchies.
  • Progress indicators are available.

Bug Fixes

  • Bundle validation verifies that NSAppleEventsUsageDescription is localized if present.

Version 0.3.1 - 2019-09-26 21:11:35

New Features

  • Interface elements are localized into German.
  • CoreGraphics key codes are available on all platforms.

Bug Fixes

  • Bundle validation checks for the localized name flag.
  • Bundle validation checks Info.plist against the fallback localization’s InfoPlist.strings file.

Version 0.3.0 - 2019-07-18 01:43:47

Breaking Changes

  • More types have been moved out of SDGInterfaceElements into specialized modules.
  • More alias pairs have been replaced with encapsulating types.

Version 0.2.1 - 2019-07-15 23:16:02

New Features

  • TextFields have a bindable text value.
  • Windows have a closeAction that will be executed when the window closes.

Bug Fixes

  • Changing the sort order causes Table views to refresh.

Version 0.2.0 - 2019-07-13 00:11:17

Breaking Changes

  • Many types have been moved out of SDGInterfaceElements into specialized modules.
  • Many alias pairs have been replaced with encapsulating types.
  • Sections of the API have been restricted to platforms where they are meaningful.

New Features

  • SDGInterface can be used on Linux, although large portions of the API are unavailable.

Version 0.1.0 - 2019-06-27 02:00:57

Initial release.