I have several protocol methods that a develop can call as delegates when they install my cocoapod. However, they are currently all required to be implemented. How do I go about making them optional? Here's a snippet of one:
In my cocoapod's code:
public protocol ServiceDelegate: NSObjectProtocol {
func didDetectDoubleTapGesture()
}
//To fire the protocol method...
delegate?.didDetectDoubleTapGesture()
From the developer's side:
extension ViewController: ServiceDelegate {
func didDetectDoubleTapGesture() {
print("didDetectDoubleTapGesture")
}
}
It currently works, but I want to make it optional for the developer to have to implement the 'didDetectDoubleTapGesture()' delegate method. So far I have tried '@objc' and '@optional'. What is the cleanest way to do this?