Adela Toderici
Adela Toderici

Reputation: 1112

Can anybody explain me the role of @required and @optional concept when I create my own @protocol?

I have to create my own @protocol and @delegation in my interface. I read about this functionality and I understood it but I don't know the role of @required and @optional in @protocol.

Why I have to use it? The @protocol will works the same if I don't separate my methods?

Upvotes: 0

Views: 81

Answers (1)

MartinMoizard
MartinMoizard

Reputation: 6690

@required methods have to be implemented when a class implements a protocol, and @optional methods do not necessary have to be implemented.

By default, all methods declared in a protocol are required methods.

Upvotes: 1

Related Questions