I was trying to implement swift's alternative to the respondsToSelector:
syntax that was also shown in the keynote.
I have the following:
protocol CustomItemTableViewCellDelegate {
func changeCount(sender: UITableViewCell, change: Int)
}
and then later in the code I call
class CustomItemTableViewCell: UITableViewCell {
var delegate: CustomItemTableViewCellDelegate
...
override func touchesEnded(touches: NSSet!, withEvent event: UIEvent!) {
...
delegate?.changeCount?(self, change: -1)
}
...
}
I get the following errors
Operand of postfix '?' should have optional type; type is '(UITableViewCell, change:Int) -> ()'
Operand of postfix '?' should have optional type; type is 'CustomItemTableViewCellDelegate'
Partial application of protocol method is not allowed
What I am doing wrong?
Thanks