Tuesday, October 22, 2013

Delegate Design Pattern in iOS

About: -

Suppose there is message passing between two objects X, Y.
Suppose an employee and a boss, when employee finishes his task and he has to inform boss about that how would it do?

This is possible in terms of delegate. When X and Y are two objects like employee and boss and as soon as X finishes its task Y is told about it.

Features: -

1.     The main thing is reducing the interdependency of classes.
2.     To make the class more reusable.
3.     Al l the methods of delegate are in protocol, where the person can set required or optional.
4.     Required are compulsory for the delegate to implement.
5.     Optional are not compulsory for the delegate to implement.

Below is the link of git repository to download the delegate sample code: -

Have fun.. !!! Any problems post in comments.