Duncan Groenewald Duncan Groenewald - 4 years ago 382
Swift Question

How to use NSEventMask with Swift

Why am I getting a compiler error indicating the boolean OR function "|" cannot be used with in the following manner:

localEvent = self.window.nextEventMatchingMask(NSEventMask.LeftMouseUpMask | NSEventMask.LeftMouseDraggedMask)


EDIT:

Here is what I eventually found to work

localEvent = self.window!.nextEventMatchingMask(Int(NSEventMask.LeftMouseUpMask.rawValue | NSEventMask.LeftMouseDraggedMask.rawValue))!

Answer Source

Try like this:

localEvent = window.nextEventMatchingMask(Int(NSEventMask.LeftMouseUpMask.rawValue))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download