in Technology by
Explain types of protocol in Objective C?

1 Answer

0 votes
by

formal protocol declares a list of methods that client classes are expected to implement. Formal protocols have their own declaration, adoption, and type-checking syntax. You can designate methods whose implementation is required or optional with the @required and @optional keywords. Subclasses inherit formal protocols adopted by their ancestors. A formal protocol can also adopt other protocols. Formal protocols are an extension to the Objective-C language.

An informal protocol is a category on NSObject, which implicitly makes almost all objects adopters of the protocol. (A category is a language feature that enables you to add methods to a class without subclassing it.) Implementation of the methods in an informal protocol is optional. Before invoking a method, the calling object checks to see whether the target object implements it. Until optional protocol methods were introduced in Objective-C 2.0, informal protocols were essential to the way Foundation and AppKit classes implemented delegation.

Related questions

0 votes
    Explain what is protocol in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Explain the difference between Swift vs Objective-C.?...
asked Nov 30, 2020 in Technology by JackTerrance
0 votes
    Can we create Dynamic Classes in Objective C? If Yes, Explain how to create with a valid use case?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Is Objective C, a dynamic language? True/False, explain....
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Explain what is dot notation in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Explain how to call function in Objective-C....
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Explain what is @synthesize in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Explain when to use NSArray and NSMutableArray. Which one is faster and threadsafe in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Can we use both swift (.swft) and objective c (.h .m) in same xcode project ?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    How do I call Objective-C code from Swift?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    What are benefits of collections views in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    How we can layout subviews in a view in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    What are the size classes in Objective-c?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    Why create a custom view in Objective-C?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    What is bundle in Objective-c?...
asked Nov 10, 2020 in Technology by JackTerrance
...