Delegation in iOS and Cocoa: Decorator Pattern

Standard

Using delegates in iOS and Cocoa is a very basic and fundamental part and we use them very frequently in our codes. As like in business, cocoa uses delegates as a formal way to pass work/data from one object to another. In business, you want to do make something but you need raw materials to do so. So you ask the supplier to give you raw materials and you sign a contract for that. Same goes in cocoa, a class that wants to perform a task that depends on the response of another class acts as the delegate to the later. The first class wants to be the contractor of the later one by signing a contract called protocols (as defined in cocoa).

Continue reading

About Delegation Part – 3

Standard

Hello guys and welcome to the third and final part of our discussion on Objective-C protocols and delegation. On the last part we had finished our code and left the discussion for this part. Well, what are we waiting for? Open the project and run  it  on the simulator, you’ll see something like this: Continue reading

About Delegation Part – 2

Standard

Hello again, welcome to the second part of the discussion on iOS protocol and delegates. On the previous part I left on the theoretical discussion about what are Objective-C protocol and delegates. Here is the link to first part of this discussion. Moving forward, I am going to give a practical example and explain more on this topic. Continue reading

About Delegation Part -1

Standard

Hello again everyone and hope you’re doing fine. Welcome to the first part of my new discussion topic. Today I am going to discuss about the Objective-C protocols and delegates. Anybody new to Objective-C is well aware of the hassle of understanding the concept of delegation. I have heard a lot of people bragging about how complex the concept is to them. Well, me myself had a tough time understanding it. But when you come to understand, you will feel how well this concept makes sense. And of course object oriented programming is all about how you feel about the code and how it comes to make sense, isn’t it?
Continue reading