I have a protocol like so :
public protocol SubmitAgeDelegate : class {
func changeSubmitButtonBool()
}
The problem is I want to call it in a generics class.
open class GenericController<UICollectionViewCell,UICollectionReusableView> {
weak var submitAgeDelegate: SubmitAgeDelegate?
Within a UITapGestureRecognizer
func tapGestureDidRecognize(_ gesture: UITapGestureRecognizer) {
if let myAgeDelegate = self.submitAgeDelegate {
print("inside delegate") //Never gets inside
myAgeDelegate.changeSubmitButtonBool()
}
}
Not too sure why it never gets called? Similar ways have worked in regular classes withing IBAction functions.
In my other class :
open class MyCell: ActionCell, SubmitAgeDelegate {
weak var submitAgeDelegate: SubmitAgeDelegate?
public override init(frame: CGRect) {
super.init(frame: frame)
submitAgeDelegate = self
initialize()
}
// Delegate
public func changeSubmitButtonBool(){
print("called ")
}