I used to think that the default/implicit specifier for protocol methods is optional. However, in my current project I see a warning if I do not add the @optional specifier specifically. Not a big deal. I am just wondering, was it optional the default for a while, and now it is required? Or maybe I missed something while I was learning Objective-C a while ago.
Thanks in advance!
@required
was always by default to gurantee, that you app won't crash if you inherit protocol and forget to implemet methods. So you should manuall set @optional
From the Apple documentation
By default, all methods declared in a protocol are required methods.
It's always been required by default. There is no way that has changed or many things would suddenly start breaking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With