Skip to content

Instantly share code, notes, and snippets.

@dagronf
Last active August 9, 2019 08:14
Show Gist options
  • Save dagronf/46066d2ddf79d36e45d1b9c51d4a45cc to your computer and use it in GitHub Desktop.
Save dagronf/46066d2ddf79d36e45d1b9c51d4a45cc to your computer and use it in GitHub Desktop.
NSButton with interaction disabled
import Cocoa
class DSFUnenabledButton: NSButton {
var isUserInteractionEnabled = false
override func hitTest(_ point: NSPoint) -> NSView? {
return isUserInteractionEnabled ? super.hitTest(point) : nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment