filmov
tv
Swift Programming : Design Patterns : The Delegate Pattern

Показать описание
Get Our Auto Layout Course at A Great Discount. Click here :
Swift 2.0 Programming : Design Patterns : The Delegate Pattern
In this video we will see a simple example of the Delegate pattern in Swift.
Overview:
=========
In this video I will talk about the Delegate Pattern.
This is not only a powerful but also a commonly used pattern in Swift.
For example when using TableViews or Textfields, you will often see this pattern in action
So lets set the ball rolling by taking a NON Swift example to understand the concept.
Let's say you are in the process of building yoou dream house.
You broadly know what you want:
You want the following :
BuyPlotofLand
RegisterPlotOfLand
BuildHouse
BuildGarden
BuildSwimmingPool
RegisterHouse
Now while you know what you want, you do not know how it will be done. No worries. HousingAgents are there to help you.
Each agent provides a blueprint on how they will implement each of your requirements.
You then select the most reasonable agent and delegate the job to them.
Now let's not read too much into this example but just understand a few points.
We have one object who provides a protocol or blueprint of what it wants but it does not know how? This is the delegating object.
Then we have another object who is capable of satisfying one or all of these protocol tasks. This object is then entrusted the task of implementing the protocol.
This object is the delegate.
Alright with this example behind us, lets head to Xcode and look at Delegation with another example.
Delegate Notes:
==============
Basic steps to use delegation are the same:
a. Create a delegate protocol that defines the responsibilities of the delegate.
b. Create a delegate property in the delegating class to keep track of the delegate.
c. Adopt and implement the delegate methods in the delegate class.
d. Call the delegate from the delegating object
References:
=========
Tools Used:
==========
Microphone : Blue Yeti
Voice Editor : Audacity
Animation : Sparkol Video scribe
Video editor + SFX : iMovie + ScreenFlow
Computer : MacBook Air
Individuals involved in Video:
=================
Sanjay Noronha , Ravi Shankar
Swift 2.0 Programming : Design Patterns : The Delegate Pattern
In this video we will see a simple example of the Delegate pattern in Swift.
Overview:
=========
In this video I will talk about the Delegate Pattern.
This is not only a powerful but also a commonly used pattern in Swift.
For example when using TableViews or Textfields, you will often see this pattern in action
So lets set the ball rolling by taking a NON Swift example to understand the concept.
Let's say you are in the process of building yoou dream house.
You broadly know what you want:
You want the following :
BuyPlotofLand
RegisterPlotOfLand
BuildHouse
BuildGarden
BuildSwimmingPool
RegisterHouse
Now while you know what you want, you do not know how it will be done. No worries. HousingAgents are there to help you.
Each agent provides a blueprint on how they will implement each of your requirements.
You then select the most reasonable agent and delegate the job to them.
Now let's not read too much into this example but just understand a few points.
We have one object who provides a protocol or blueprint of what it wants but it does not know how? This is the delegating object.
Then we have another object who is capable of satisfying one or all of these protocol tasks. This object is then entrusted the task of implementing the protocol.
This object is the delegate.
Alright with this example behind us, lets head to Xcode and look at Delegation with another example.
Delegate Notes:
==============
Basic steps to use delegation are the same:
a. Create a delegate protocol that defines the responsibilities of the delegate.
b. Create a delegate property in the delegating class to keep track of the delegate.
c. Adopt and implement the delegate methods in the delegate class.
d. Call the delegate from the delegating object
References:
=========
Tools Used:
==========
Microphone : Blue Yeti
Voice Editor : Audacity
Animation : Sparkol Video scribe
Video editor + SFX : iMovie + ScreenFlow
Computer : MacBook Air
Individuals involved in Video:
=================
Sanjay Noronha , Ravi Shankar
Комментарии