mouseDown事件无法在swift playground中运行

时间:2017-03-22 23:09:03

标签: swift macos nsevent

在macOS上使用swift playground时,我试图检测鼠标点击但它无效。这是我的代码......

func mouseDown(theEvent : NSEvent) {
print("left mouse")
}

我不能使用override func,因为它会给我一个错误,我不确定这是不是在继承NSViewController的类中。如果我必须使用NSViewController你能告诉我如何更新另一个类中的变量值。有人可以帮忙吗?

0 个答案:

没有答案