Title: Theory / Important / CS / Programming / Objective-C / Documentation / Delegate

Name: A responder
Definition: An object that respond to user event
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Context: Objective C

Name: A delegate
Definition: an object that acts on behalf of, or in coordination with, another object when that object encounters an event in a program
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Context: Objective C

Question: How does a delegating object knows whether it should call a delegate selector
Answer: If the method is mandatory, directly call it
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Context: Objective C
Answer2: If the method is optional, uses `respondsToSelector` to check whether the delegate implements the selector

Question: How is a delegation method named
Answer: name of the AppKit or UiKit object doing the delegating
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Context: Objective C
Answer2: Usually (but not always) this object name is followed by an auxiliary verb indicative of the temporal status of the reported event. This verb, in other words, indicates whether the event is about to occur (“Should” or “Will”) or whether it has just occurred (“Did” or “Has”).
Answer3: verb indicating what will/did occur

Question: Who is responsible for retaining delegate object
Answer: Clients of delegating objects, not the delegating object itself
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Context: Objective C

Question: How to set an object as delegate of O
Answer: Set your object as the delegate (by assigning it to the delegate property). You can do this programmatically or through Interface Builder.
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Variables: O an object
Context: Objective C
Answer2: If the protocol is formal, declare that your class adopts the protocol in the class definition. For example:
@interface MyControllerClass : UIViewController <UIAlertViewDelegate> {
Answer3: Implement all required methods of the protocol and any optional methods that you want to participate in.

Name: A data source
Definition: A delegate in charge of providing data
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Variables: O an object
Context: Objective C

Question: How to create a class that uses a delegate
Answer: Create a method `delegate` that return the delegate
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html
Variables: O an object
Context: Objective C
Answer2: Create a method `setDelegate` that set the delegate
Answer3: If you have a pointer to the delegate, make it weak

Question: What are objective-C introspection capabilities
Answer: Where an object is in the inheritance tree
Page: https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/Introspection/Introspection.html
Context: Objective C
Answer2: whether an objects conforms to a specific protocol
Answer3: Whether an object responds to a certain message