I need some help with understanding the class declaration syntax in Objective C, or to be more specific
@interface SomeViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate>
what does UITableViewDataSource,UITableViewDelegate mean
My understanding is that it receives these two objects when the class is instantiated.Correct me if I am wrong..
When you declare a class, the <> syntax allows you to specify a list of protocols the class must comply with.
A protocol is a "set" of methods that your class must implement (You can specify optional methods too). They only have method declarations, but the programmer must implement them in his classes. Protocols are really important in Objective-C since they are the heart of the delegation pattern.
In this specific case, UITableViewDelegate is a protocol that an object that deals with UITableViews must comply with. Table View delegates are responsible for controlling the table and it's cells, such as setting their heigh, accesories, etc.
UItableViewDataSource is a protocol an object that gives data to a table view must comply with. An object complying with this protocol is responsible for returning the data that will be displayed in a table view.
Not using the protocols when needed can create warnings that will sooner or later crash your app.