JanX2 / ShortcutRecorder

A user interface control to record key combinations. For Mac OS X, uses Cocoa.

Home Page:http://code.google.com/p/shortcutrecorder/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object of class SRShortcut is not among allowed top level class list

chensifang opened this issue · comments

Error:Object of class SRShortcut is not among allowed top level class list

import ShortcutRecorder

let defaults = NSUserDefaultsController.shared
let keyPath = "values.shortcut"
let options = [NSBindingOption.valueTransformerName: .keyedUnarchiveFromDataTransformerName]

let beepAction = ShortcutAction(keyPath: keyPath, of: defaults) { _ in
    NSSound.beep()
    return true
}
GlobalShortcutMonitor.shared.addAction(beepAction, forKeyEvent: .down)

let recorder = RecorderControl()
recorder.bind(.value, to: defaults, withKeyPath: keyPath, options: options)

recorder.objectValue = Shortcut(keyEquivalent: "⇧⌘A")
commented

This is not a maintained repo. Everyone is probably best served by Kentzo’s fork.