Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
final class SampleViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(type: .System)
// ...
button.addTarget(self, action: #selector(SampleViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside)
view.addSubview(button)
}
@objc private func buttonTapped(button: UIButton) {
print("Selector method called!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment