December 2018
Intermediate to advanced
414 pages
10h 19m
English
We'll now put those protocols to work. Let's imagine you're building an app that helps open source maintainers. New contributors are rare, and it's important to thank them in a timely manner.
Let's implement a simple program that will determine who to send a thank you note to, 3 days after their contribution, out of all the contributions to the repository:
struct Contribution { let date: Date let author: String let email: String let details: String}
Contribution is a simple object of itself, which holds information about the contributor and their contribution.
Now we need to make those Contribution objects Visitable so we can use Visitors on them:
extension Contribution: Visitable {} ...Read now
Unlock full access