Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing hotkey in viewDidLoad() results in nothing when shortcut is activated #28

Open
brendanballon opened this issue Jun 28, 2020 · 2 comments

Comments

@brendanballon
Copy link

Here's my code (I'm just making a test application)

import Cocoa
import HotKey

class ViewController: NSViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let hotkey = HotKey(keyCombo: KeyCombo(key: .p, modifiers: [.control, .command]))
        hotkey.keyDownHandler = {
            print("Something should happen")
        }
        // Do any additional setup after loading the view.
    }

    override var representedObject: Any? {
        didSet {
        // Update the view, if already loaded.
        }
    }

    }

I'm just wondering if I'm doing any of this right, as you may be able to tell I'm a beginner.

@tuanphamanh91
Copy link

@brendanballon hi, got same error, how did you handle it?

@Liaoworking
Copy link

same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants