The Complete Understanding of Swift Delegate and Data Source
Motivation
I’ve noticed not only the delegate/data source pattern exists everywhere within the iOS ecosystem, but also most people simply copy and paste without knowing the behind implementation.
If you’ve wondered how UITableViewDataSource works, you might have come to the right place.
Introduction
First, the delegate design pattern is used to pass data or communicate between classes or structs. That’s it. The word “delegate” may come across confusing. I will try to use analogy throughout the tutorial.
Your job is to pass data from FirstVC
to SecondVC
. Let us use the delegate pattern. First, you need to create a protocol that has a required function with a String
parameter.
Facebook Page: https://facebook.com/bobthedeveloper