Understanding Delegate and DataSource
The Role of the Delegate Imagine you’re sitting in a restaurant. Here, you, the diner, are akin to a part of your application, let’s say a UIViewController. When you’re ready to order, you don’t go into the kitchen yourself. Instead, you tell the waiter what you’d like to eat. The waiter, in this scenario, is the ‘delegate’. In iOS, a delegate is an object that acts on behalf of another. It’s a way to extend and customize the behavior of various components....