Q:

IOS Swift: Button Action in a separate class file

I just need to implement a custom class that takes a reference of a button in initialization and then perform the action (Touch Up Inside) in there.
Just tried the folloiwng way but getting an exception saying 'unrecognized selector sent to instance 0x7fbb48615ac0'
import UIKit
class CustomButton
{
    var view: UIViewController
    var btnTest: UIButton!

    init(view: UIViewController, testBtn: UIButton)
    {
        self.view = view
        self.btnTest = testBtn

        // self.btnTest.addTarget(self, action: "btnMethod:", forControlEvents: UIControlEvents.TouchUpInside)
        self.btnTest.addTarget(self, action: Selector("btnMethod:"), forControlEvents: UIControlEvents.TouchUpInside)
    }

    func btnMethod(sender: UIButton)
    {
        println("Click alright.....")
    }
}

The complete exception message is as follows

Can't really get the point where I am going wrong in here. Would be grateful to hear what I am doing wrong. Thanks in advance!!!
Edits
Following is the full working solution
class CustomButton: NSObject
{
   var view: UIViewController
   var btnTest: UIButton!

   init(view: UIViewController, testBtn: UIButton)
   {
        self.view = view
        self.btnTest = testBtn

        super.init()
        self.btnTest.addTarget(self, action: Selector("btnMethod:"), forControlEvents: UIControlEvents.TouchUpInside)
    }

    deinit
    {
        println("De-Init happens...")
    }

    func btnMethod(sender: UIButton)
    {
        println("Click alright.....")
    }
}

A:

The code in the CustomButton class is straightforward and looks correct. The problem is that the class instance (variable) is being deinitialized and then the button is being tapped and it's trying to call the selector on an uninitialized variable.
You can confirm this by adding to your CustomButton class:
deinit {
   println("deinit")
}

If you see the deinit happen before you tap the button, you know it's going to crash when you tap.
The solution is to make sure your CustomButton variable (customBtn) in the UIViewController is a property of the class and not a local variable. That way the CustomButton will stick around as long as your UIViewController does.
class PaymentViewController: UIViewController {

  var customButton: CustomButton!
  let button: UIButton!

  override func viewDidLoad() {
     super.viewDidLoad()

     // initialize self.button

     // this instance will stick around for the life of the PaymentViewController
     customButton = CustomButton(self, button)
  }

}

