I have notice that optional methods in several protocols are defined in the iPhone SDK, such as the UIActionSheetDelegate protocol.
So my problem is that can I define a protocol of my own, and set a few of the methods as optional?
Creating our own optional methods in protocol
1474
30-Oct-2015
Updated on 30-Oct-2015
Tarun Kumar
30-Oct-2015When we create a Protocol then we need to mark '@optional' keyword, because it is responsible to create our own optional method.
Corresponding to the '@optional' keyword, here is another keyword @required, used when we want any method necessary in our code, using @optional and @required keywords we can do partition in protocol into sections and by the way by default keyword is @required in any protocol.