I’ve read that whenever you’re using a UITableView you should conform your controller class to the <UITableViewDelegate, UITableViewDataSource> protocols (if you’re not using the tailormade UITableViewController class).
So my superclass is UIViewController but I forgot to add the <UITableViewDelegate, UITableViewDataSource> declaration in the .h file. For some reason the table works anyways. It gets its data from the class and clicking cells works as expected.
Can somebody explain this to me — why it’s working?
If you still have the appropriate methods in your implementation it will work correctly. When the table view needs to call those methods it doesn’t check that your class has stated it conforms to UITableViewDelegate or UITableViewDataSource, instead it checks that your class implements the required methods.
The point of explicitly stating that you conform to a protocol is so that the compiler can generate warnings. If you try and assign an instance of your ViewController to an id but haven’t stated it in your header you will get compiler warnings, but it will still work if all the required UITableViewDataSourceDelegate methods are implemented.