Swiftpack.co -  Package - Lessica/ShortcutGuide
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Lessica/ShortcutGuide
Double-click command to present a shortcut guide for your macOS application.
.package(url: "https://github.com/Lessica/ShortcutGuide.git", from: "v1.0")

ShortcutGuide

Double-click command to present a shortcut guide for your macOS application.

Example-1.png

Usage

Add these lines to your root window's NSWindowController:

import ShortcutGuide
// ...
override func windowDidLoad() {
    super.windowDidLoad()
    // ...
    ShortcutGuideWindowController.registerShortcutGuideForWindow(window!)
}

Then, make some parts of your responder chain (NSView or NSViewController) conform to ShortcutGuideDataSource:

public protocol ShortcutGuideDataSource: NSResponder {
    var shortcutItems: [ShortcutItem] { get }
}

Define and provide your shortcuts from the protocol method above:

public struct ShortcutItem {
    let name: String
    let keyString: String
    let toolTip: String
    let modifierFlags: NSEvent.ModifierFlags
}

License

Copyright © 2021 Zheng Wu. All rights reserved.

GitHub

link
Stars: 3
Last commit: 5 days ago

Release Notes

Initial Release
2 weeks ago

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