I have a uibutton in child view controller that its action needs to be called in parent view controller. this is my code
class ChildViewController: UIViewController {
@IBOutlet weak var btn: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
btn.addTarget(nil, action: Selector(("onBtnTap")), for: .touchUpInside)
}
}
class ParrentViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
func onBtnTap(sender: Any) {
print("Hey, I am Parent VC ")
}
}
when i tap button the method onBtnTap not called and no crash occurred .