Delegates - why aren't we declaring them?



Just a quick question - I thought that I would have to add and in BNRItemsViewController, but it appears I do not - we just throw in the required methods - why is this the case? Wouldn’t it be safer to declare that BNRItemsViewController is the delegate and move on? Is there something I’m missing?



This may surprise you, but you don’t have to declare any methods in Objective-C.

As long as you know the signature of a method and the method has been implemented, you can invoke the method; the runtime will find and execute it.

Some people argue that this is a serious weakness in the language, while others argue otherwise.


Edit: deleted


In BNRItmesViewController.h you describe the interface

when you cmd+click on UITableViewController you see

NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

So the UITableViewController inherits from the UIViewController which conforms to the UITableViewDelegate, UITableViewDataSource protocols.