NSClickGestureRecognizer not working to invoked the registered event method

I have created a NSView inside the NSWindow. I m trying to identify when the view gets clicked by the user. For this I m using NSClickGestureRecognizer, but the registered method is not getting invoked. I have tried adding this for other widgets like button but it does not work either. Am I missing something?


class SelectionList :NSObject, NSTextFieldDelegate{


    let containerView = NSView()

    func createSelectionList (pWindow: NSWindow) {

       // created container View

...

            let clickRecognizer = NSClickGestureRecognizer()

            clickRecognizer.target = self

            clickRecognizer.buttonMask = 0x2 // right button

            clickRecognizer.numberOfClicksRequired = 1

            clickRecognizer.action = #selector(ClickGestured)

            containerView .addGestureRecognizer(clickRecognizer)

    }

    @objc
    func clickRecognizer() {
       print("clicked")
    }

}
NSClickGestureRecognizer not working to invoked the registered event method
 
 
Q