why we set delegate to self always, what does delegate do | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

why we set delegate to self always, what does delegate do

8th Sep 2016, 4:27 PM
Prashant
Prashant - avatar
4 Answers
+ 2
A delegate is an object that promise he can get the job done on behalf of another object. There is a contract between the two objects to handle the job: Optional methods and required methods to implement. when you say textField.delegate = self. That means that the instance where the statement is coded says: "yes I am going to be able to get the job done for you, tell me your requirements and optional methods to complete the tasks needed. I see this like that, hope it helps. Enjoy
17th Sep 2016, 1:42 AM
Abdelkader Ait Assou
Abdelkader Ait Assou - avatar
+ 1
Try the following alternative explanation. I got my understanding about delegate from this: http://stackoverflow.com/questions/24099230/delegates-in-swift/33549729#33549729
18th Sep 2016, 7:38 PM
swifty
0
Still can't understand, I'd already read this
17th Sep 2016, 3:45 AM
Prashant
Prashant - avatar
0
Yeah that helped me, Thanks
19th Sep 2016, 3:50 AM
Prashant
Prashant - avatar