I\'ve been using selectors for a while, and even after migrating to Swift I was able to use them without issues. That\'s how I was using on Swift 2 without issues until I up
Both following statements work perfectly. The upper one is mostly used. However when the selector method is in a different ViewController the compiler warning "No method declared with Objective-C selector 'buttonHandler'" may occur.
The second listed statement does not give this warning.
button.addTarget(parentViewController, action: Selector("buttonHandler:"), forControlEvents: .TouchUpInside)
button.addTarget(parentViewController, action: #selector(MainViewController.buttonHandler), forControlEvents: .TouchUpInside)
In the target view controller (MainViewController) you can define the module:
func buttonHandler(sender:UIButton!) {
print ("Pressed")
}