Swift doesn't allow protocols to have optional requirements-- if the protocol declares something, it's required. Objective-C has long had the idea of optional requirements, and Swift recognizes this when you use @objc when declaring the protocol. So using @objc is the easy way to get what you're after.
If you want a pure Swift solution, you need to add a protocol extension that includes default implementations of the methods. This doesn't make those methods optional, instead it says that any class that doesn't implement the method itself will use the default implementation instead. They're sort of optional in that classes don't have to implement them, but not really optional since that's only because a default implementation is available.
That would look something like this:
protocol DrawViewProtocol : class{
func drawViewDidEndEditing()
}
extension DrawViewProtocol {
func drawViewDidEndEditing() {}
}
class MyClass : DrawViewProtocol {
}
class MyOtherClass : DrawViewProtocol {
func drawViewDidEndEditing() {
print("Foo")
}
}
Now if I create an instance of MyClass and call drawViewDidEndEditing(), it uses the default implementation, which does nothing. If I create an instance of MyOtherClass, the same method call prints "Foo".