Skip to content

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

License

Notifications You must be signed in to change notification settings

Lessica/ShortcutGuide

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published